1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define BLINKER_PRINT Serial
#define BLINKER_WIFI

#include <Arduino.h>
#include "Blinker.h"

BlinkerButton btn("btn1");


char auth[] = "451e8b110ad6";
char ssid[] = "LAPTOP-7JQ424S8";
char pswd[] = "12345678";

void handleBtn(const String &state) {
if (state == "on") {
digitalWrite(LED_BUILTIN, LOW);
btn.print("on");
} else {
digitalWrite(LED_BUILTIN, HIGH);
btn.print("off");
}
}
void setup() {

pinMode(LED_BUILTIN, OUTPUT);

// Blinker.begin(auth,ssid,pswd);//设备的key,ifi名,wifi密码
btn.attach(handleBtn);
digitalWrite(LED_BUILTIN, HIGH);
}


void loop() {
Blinker.run();
}