求助上传失败
#define BLINKER_WIFI
#define BLINKER_ALIGENIE_OUTLET
#include <Blinker.h>
char auth[] = "c86a1e269e3c";
char ssid[] = "antbang_1AE9A8";
char pswd[] = "13550697528";
BlinkerButton Button1("btn-abc");
bool oState = false;
int Pin = 0;
void AliGeniePowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(Pin, LOW);
BlinkerAliGenie.powerState("on");
BlinkerAliGenie.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(Pin, HIGH);
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("millis", BlinkerTime);
}
void button1_callback(const String & state)
{
BLINKER_LOG("get button state: ", state);
digitalWrite(Pin, !digitalRead(Pin));
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(Pin, OUTPUT);
digitalWrite(Pin, HIGH);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
BlinkerAliGenie.attachPowerState(AliGeniePowerState);
BlinkerAliGenie.attachQuery(AliGenieQuery);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
请描述清除您的问题 程序上传失败和blinker无关
您的帖子 https://www.arduino.cn/thread-102594-1-1.html 已移动到8266板块
页:
[1]