Skip to content

Commit 79dde56

Browse files
committed
update MQTT example
1 parent 9c2313e commit 79dde56

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

examples/Blinker_MQTT/MQTT_WiFi/MQTT_WiFi.ino

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#define BLINKER_PRINT Serial
22
#define BLINKER_MQTT
33

4+
#define BUTTON_1 "ButtonKey"
5+
46
#include <Blinker.h>
57

68
char auth[] = "<Your MQTT Secret Key>";
@@ -10,7 +12,11 @@ char pswd[] = "<Your WiFi network WPA password or WEP key>";
1012
void setup() {
1113
Serial.begin(115200);
1214

15+
pinMode(LED_BUILTIN, OUTPUT);
16+
digitalWrite(LED_BUILTIN, LOW);
17+
1318
Blinker.begin(auth, ssid, pswd);
19+
Blinker.wInit(BUTTON_1, W_BUTTON);
1420
}
1521

1622
void loop()
@@ -26,4 +32,8 @@ void loop()
2632
Blinker.print(BlinkerTime);
2733
Blinker.print("millis", BlinkerTime);
2834
}
35+
36+
if (Blinker.button(BUTTON_1)) {
37+
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
38+
}
2939
}

0 commit comments

Comments
 (0)