|
设备信息- 硬件: Arduino UNO+HM10
- 接入方式: [BLE]
- blinker库版本: [arduino 0.3.2]
- 开发环境: [Arduino]
- 操作系统: [Windows]
- 手机信息及APP信息
- HUAWEI MATE20 PRO
- android9
- blinker 2.2.7
问题描述刚接触blinker app 按照文档里的步骤连接了设备,代码是范例里给的blinker hello ble,app界面也是用的给的示例,但未能控制灯的熄灭,请问这是什么原因啊?
代码#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: ", state);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
counter++;
Number1.print(counter);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
Blinker.begin(0,1,9600);
Blinker.attachData(dataRead);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
|
|