|
//WiFiduino板需要实现的功能:blinker APP 滑条组件控制外接LED灯的亮度
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "***********";
char ssid[] = "********";
char pswd[] = "********";
#define Slider_1 "SliderKey"
BlinkerSlider Slider1(Slider_1);
void slider1_callback(int32_t value)
{ //这里改用WiFiduino板上的D12端口
digitalWrite(D12, !digitalRead(D12));
BLINKER_LOG("get slider value: ", value);
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print(BlinkerTime);
Blinker.print("millis", BlinkerTime);
Slider1.color("#FFFFFF");
Slider1.print(random(0, 128));
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(D12, OUTPUT);
digitalWrite(D12, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Slider1.attach(slider1_callback);
}
void loop()
{
Blinker.run();
}
APP里面的滑块组件的键名也换了,都不行,不知道是啥问题。哪位大神可以解决一下,谢谢
|
|