小爱同学控制没得反应
本帖最后由 lh5263872 于 2020-8-10 10:50 编辑回应,先帮你操作了,看看设备状态吧
串口没有小爱同学的debug输出
之前做的东西小爱语音控制没有问题,而且串口也有提示收到小爱控制指令
#define BLINKER_MIOT_OUTLET
void miotPowerState(const String & state) { //小爱控制开关窗
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(mclose, LOW);
digitalWrite(mopen, HIGH);
moter_time = millis();
hbsta = 1;
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(mopen, LOW);
digitalWrite(mclose, HIGH);
setjuli = 100;
moter_time = millis();
hbsta = 2;
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
oState = false;
}
}
void miotQuery(int32_t queryCode) {
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
BLINKER_LOG("MIOT Query Power State");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
}
}
void setup() {
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
BLINKER_DEBUG.debugAll();
BlinkerMIOT.attachPowerState(miotPowerState); BlinkerMIOT.attachQuery(miotQuery);
}
你这和示例就是两回事,写都没写对 XlinliY.Zhang 发表于 2020-8-9 23:39
你这和示例就是两回事,写都没写对
问题就是我没看出来这部分代码哪里没搞对,帅哥帮忙看看 lh5263872 发表于 2020-8-10 10:45
问题就是我没看出来这部分代码哪里没搞对,帅哥帮忙看看
Arduino IDE -> 文件 -> 示例 -> Blinker -> Blinker_MIOT XlinliY.Zhang 发表于 2020-8-10 18:41
Arduino IDE -> 文件 -> 示例 -> Blinker -> Blinker_MIOT
#define BLINKER_WIFI
#define BLINKER_MIOT_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 miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(LED_BUILTIN, HIGH);
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(LED_BUILTIN, LOW);
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
oState = false;
}
}
void miotQuery(int32_t queryCode)
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("MIOT Query All");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
BLINKER_LOG("MIOT Query Power State");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
}
}
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);
BlinkerMIOT.attachPowerState(miotPowerState);
BlinkerMIOT.attachQuery(miotQuery);
}
void loop()
{
Blinker.run();
} XlinliY.Zhang 发表于 2020-8-10 18:54
问题找到了,有个库没更新不兼容 lh5263872 发表于 2020-8-11 18:46
问题找到了,有个库没更新不兼容
哪个库有问题,我也是出现这个毛病 zwl1861 发表于 2020-8-11 19:22
哪个库有问题,我也是出现这个毛病
我是esp8266,好像最新是2.7.4,没有更新,还有个激光测距模块的库没更新 我也是这样,小爱那里在线,提示控制成功,可是没反应 库连接有吗?
页:
[1]