|
使用全局变量i,但是i没有被赋值啊
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "*****";
char ssid[] = "99";
char pswd[] = "12345678";
#define Slider_1 "SliderKey"
int i=0;
BlinkerSlider Slider1(Slider_1);
void slider1_callback(int32_t value)
{
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
BLINKER_LOG("get slider value: ", value);
i=value;
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
Slider1.color("#FFFFFF");
Slider1.print(random(0, 128));
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Slider1.attach(slider1_callback);
}
void loop()
{
Blinker.run();
Serial.print("数值:");
Serial.println(i);
}
以下是串口显示:
[31055] Blinker readString: {"slider_1":162}
数值:0
数值:0
|
|