|
报错'BLINKER_LOG' was not declared in this scope是什么问题,管方代码如下
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#define BLINKER_ALIGENIE_OUTLET
#include <Blinker.h>
char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";
bool oState = false;
void aligeniePowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(LED_BUILTIN, HIGH);
BlinkerAliGenie.powerState("on");
BlinkerAliGenie.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(LED_BUILTIN, LOW);
BlinkerAliGenie.powerState("off");
BlinkerAliGenie.print();
oState = false;
}
}
void aligenieQuery(int32_t queryCode)
{
BLINKER_LOG("AliGenie Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("AliGenie Query All");
BlinkerAliGenie.powerState(oState ? "on" : "off");
BlinkerAliGenie.print();
break;
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
BLINKER_LOG("AliGenie Query Power State");
BlinkerAliGenie.powerState(oState ? "on" : "off");
BlinkerAliGenie.print();
break;
default :
BlinkerAliGenie.powerState(oState ? "on" : "off");
BlinkerAliGenie.print();
break;
}
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print(BlinkerTime);
Blinker.print("millis", BlinkerTime);
}
void setup()
{
Serial.begin(115200);
#if defined(BLINKER_PRINT)
BLINKER_DEBUG.stream(BLINKER_PRINT);
#endif
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
BlinkerAliGenie.attachPowerState(aligeniePowerState);
BlinkerAliGenie.attachQuery(aligenieQuery);
}
void loop()
{
Blinker.run();
}
错误如下:(
Arduino:1.8.10 (Windows 10), 开发板:"ESPino (ESP-12 Module), 80 MHz, Flash, Disabled, ck, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino: In function 'void aligeniePowerState(const String&)':
blinker_aligenie_outlet:15:48: error: 'BLINKER_LOG' was not declared in this scope
BLINKER_LOG("need set power state: ", state);
^
blinker_aligenie_outlet:20:9: error: 'BlinkerAliGenie' was not declared in this scope
BlinkerAliGenie.powerState("on");
^
blinker_aligenie_outlet:28:9: error: 'BlinkerAliGenie' was not declared in this scope
BlinkerAliGenie.powerState("off");
^
D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino: In function 'void aligenieQuery(int32_t)':
blinker_aligenie_outlet:37:52: error: 'BLINKER_LOG' was not declared in this scope
BLINKER_LOG("AliGenie Query codes: ", queryCode);
^
blinker_aligenie_outlet:41:14: error: 'BLINKER_CMD_QUERY_ALL_NUMBER' was not declared in this scope
case BLINKER_CMD_QUERY_ALL_NUMBER :
^
blinker_aligenie_outlet:43:13: error: 'BlinkerAliGenie' was not declared in this scope
BlinkerAliGenie.powerState(oState ? "on" : "off");
^
blinker_aligenie_outlet:46:14: error: 'BLINKER_CMD_QUERY_POWERSTATE_NUMBER' was not declared in this scope
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
^
D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino: In function 'void dataRead(const String&)':
blinker_aligenie_outlet:60:45: error: 'BLINKER_LOG' was not declared in this scope
BLINKER_LOG("Blinker readString: ", data);
^
D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino: In function 'void setup()':
blinker_aligenie_outlet:74:9: error: 'BLINKER_DEBUG' was not declared in this scope
BLINKER_DEBUG.stream(BLINKER_PRINT);
^
blinker_aligenie_outlet:80:35: error: no matching function for call to 'BlinkerSimpleESP8266_WS::begin(char [23], char [31], char [42])'
Blinker.begin(auth, ssid, pswd);
^
D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino:80:35: note: candidate is:
In file included from C:\Users\xuejy\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:15:0,
from D:\files\Arduino\blinker_aligenie_outlet\blinker_aligenie_outlet.ino:5:
C:\Users\xuejy\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSimpleESP8266_WS.h:47:14: note: void BlinkerSimpleESP8266_WS::begin(const char*, const char*)
void begin(const char* _ssid,
^
C:\Users\xuejy\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSimpleESP8266_WS.h:47:14: note: candidate expects 2 arguments, 3 provided
blinker_aligenie_outlet:81:13: error: 'class BlinkerSimpleESP8266_WS' has no member named 'attachData'
Blinker.attachData(dataRead);
^
blinker_aligenie_outlet:83:5: error: 'BlinkerAliGenie' was not declared in this scope
BlinkerAliGenie.attachPowerState(aligeniePowerState);
^
"ESP8266WebServer.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WebServer
"Hash.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\Hash
"Blinker.h" 对应多个库
已使用: C:\Users\xuejy\Documents\Arduino\libraries\blinker-library-master
未使用:D:\Program
"Ticker.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\Ticker
"EEPROM.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\EEPROM
"ESP8266HTTPClient.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266HTTPClient
"WiFiClient.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi
未使用:D:\Program
"ESP8266mDNS.h" 对应多个库
已使用: C:\Users\xuejy\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266mDNS
exit status 1
'BLINKER_LOG' was not declared in this scope
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
)
|
-
|