Skip to content

Commit 7b4e83c

Browse files
committed
add: blink builtin led in 1/2 Hz
1 parent aa48d3e commit 7b4e83c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

remote_wifi_sdcard.ino

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#include <RCSwitch.h>
22
#include <SPI.h>
33
#include <SD.h>
4+
#include <AsyncTimer.h>
45

6+
AsyncTimer t;
57
File myFile;
68
RCSwitch mySwitch = RCSwitch();
79
volatile unsigned long priv_decimal = 0;
810
String incomingString;
11+
bool led_state = false;
912

1013
void setup() {
1114
// put your setup code here, to run once:
@@ -25,13 +28,21 @@ void setup() {
2528
mySwitch.enableTransmit(D1);
2629

2730
pinMode(LED_BUILTIN, OUTPUT);
28-
digitalWrite(LED_BUILTIN, LOW);
31+
t.setInterval(
32+
[](){
33+
digitalWrite(LED_BUILTIN, led_state);
34+
led_state = !led_state;
35+
},
36+
1000
37+
);
2938

3039
Serial.println("ready");
3140
}
3241

3342
void loop() {
3443
// put your main code here, to run repeatedly:
44+
t.handle();
45+
3546
if (mySwitch.available()) {
3647
unsigned int protocol = mySwitch.getReceivedProtocol();
3748
unsigned long decimal = mySwitch.getReceivedValue();

0 commit comments

Comments
 (0)