使用样例Button_WiFi,稍微修改了一下,报如下警告,但是我没有哪个地方去写 EEPROM 呀。程序贴在最后面。
esp-01模块
[250]
===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================
[10044] MQTT Connected!
[10044] Freeheap: 11520
[10044] =======================================================
[10044] =========== Blinker Auto Control mode init! ===========
[10048] Warning!EEPROM address 0-1279 is used for Auto Control!
[10054] =========== DON'T USE THESE EEPROM ADDRESS! ===========
[10059] =======================================================
[33898] get button state: on
[33898] Toggle on!
[37779] get button state: off
[37779] Toggle off!
程序代码
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "**********";
char ssid[] = "****";
char pswd[] = "****";
#define BUTTON_1 "btn-abc"
#define jdq_io 0
BlinkerButton Button1(BUTTON_1);
void button1_callback(const String & state)
{
BLINKER_LOG("get button state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(jdq_io, LOW);
BLINKER_LOG("Toggle on!");
Button1.color("#FF0000");
Button1.text("开");
Button1.print("on");
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(jdq_io, HIGH);
BLINKER_LOG("Toggle off!");
Button1.color("#FFFF00");
Button1.text("关");
Button1.print("off");
}
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(jdq_io, OUTPUT);
digitalWrite(jdq_io, LOW);
Blinker.begin(auth, ssid, pswd);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
|