各位老师:这个怎么试都不行:'( ,有时间的话点拨一下下吧:D
我把例子中led默认HIGH,改为LOW;
[mw_shl_code=arduino,true]
#define BLINKER_BLE
#include <Blinker.h>
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");
int counter = 0;
void button1_callback(const String & state)
{
BLINKER_LOG("get button : ", state);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker : ", data);
counter++;
Number1.print(counter);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin();
Blinker.attachData(dataRead);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}[/mw_shl_code] |