奈何col
发表于 2020-7-13 15:46
13580445117 发表于 2020-7-13 15:45
我的ESP8266,是常亮,(开发板LED是接GPIO2,不过上面的定义LED_BUILTIN应该跟接哪个都没关系吧),量了其它 ...
直接把LED_BUILTIN改成你要控制的IO就行了
13580445117
发表于 2020-7-13 15:54
没错,我是在源程序BUTTON-WIFI中改,直接改管脚还是不行,后来用你上面的程序就可以了,管脚也不用改,系统会自动判断
奈何col
发表于 2020-7-13 15:56
13580445117 发表于 2020-7-13 15:54
没错,我是在源程序BUTTON-WIFI中改,直接改管脚还是不行,后来用你上面的程序就可以了,管脚也不用改,系 ...
说明你改错了呗
13580445117
发表于 2020-7-13 15:56
话说原代码为什么不行?
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "??????????";
char ssid[] = "yyyyyyy";
char pswd[] = "xxxxxxxx";
#define BUTTON_1 "ButtonKey"
BlinkerButton Button1(BUTTON_1);
void button1_callback(const String & state)
{
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
BLINKER_LOG("get button state: ", state);
if (state == BLINKER_CMD_BUTTON_TAP) {
BLINKER_LOG("Button tap!");
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
Button1.print();
}
else if (state == BLINKER_CMD_BUTTON_PRESSED) {
BLINKER_LOG("Button pressed!");
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
Button1.print();
}
else if (state == BLINKER_CMD_BUTTON_RELEASED) {
BLINKER_LOG("Button released!");
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
// Button1.text("Your button name", "describe");
Button1.print();
}
else if (state == BLINKER_CMD_ON) {
BLINKER_LOG("Toggle on!");
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
// Button1.text("Your button name", "describe");
Button1.print("on");
}
else if (state == BLINKER_CMD_OFF) {
BLINKER_LOG("Toggle off!");
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
// Button1.text("Your button name", "describe");
Button1.print("off");
}
else {
BLINKER_LOG("Get user setting: ", state);
Button1.icon("icon_1");
Button1.color("#FFFFFF");
Button1.text("Your button name or describe");
// Button1.text("Your button name", "describe");
Button1.print();
}
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
}
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);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
13580445117
发表于 2020-7-13 16:04
奈何col 发表于 2020-7-13 15:56
说明你改错了呗
肯定不会改错,几处的定义都替换
极光ASLSE
发表于 2020-7-20 00:53
为啥在回调函数里调用RCSwitch射频库发射不了,放loop里就可以,GPIO的灯亮了,说明是执行过的
if (state == BLINKER_CMD_ON) {
digitalWrite(GPIO, HIGH)
mySwitch.send(14112192, 24);
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
奈何col
发表于 2020-7-20 01:27
极光ASLSE 发表于 2020-7-20 00:53
为啥在回调函数里调用RCSwitch射频库发射不了,放loop里就可以,GPIO的灯亮了,说明是执行过的
if (state...
回调中不能有耗时的操作,可能你用的库中有耗时的操作,如delay
rubike
发表于 2020-7-25 21:17
我复制的这个代码,为啥一直报错?
奈何col
发表于 2020-7-25 21:54
rubike 发表于 2020-7-25 21:17
我复制的这个代码,为啥一直报错?
向上滚动,看写有error的,就是报错信息
Qunicy
发表于 2020-7-31 15:18
您好,我这边路由器上面显示WIFIduino和手机都链接到路由器了,但是手机APP还是显示离线,串口监视器也有数据,请问这是什么情况呢?
页:
1
2
3
4
5
6
7
[8]
9
10
11
12