小爱语音开灯关灯 提示要操作的设备出问题
https://www.bilibili.com/video/BV1Xf4y1e7vt/?spm_id_from=333.788.recommend_more_video.2&vd_source=adf71c20183cc2806150f235c04ae95a看B站视频制作的 在米家也显示设备了 不能语音控制点灯科技可以正常开关
#define BLINKER_MIOT_LIGHT
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "ff376716aec4";//电灯科技上的密钥
char ssid[] = "360WiFi-ABDBDF";//你家的WiFi名字
char pswd[] = "@XINYU404";//你家WiFi的密码
int GPIO=0;
#define BUTTON_1 "ButtonKey"
BlinkerButton Button1("anniu");//这个anniu必须要和电灯科技上的按键相同
void button1_callback(const String & state)
{
BLINKER_LOG("get button state: ", state);
digitalWrite(GPIO,!digitalRead(GPIO));
Blinker.vibrate();
}
void miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ",state);
if (state == BLINKER_CMD_OFF) {
digitalWrite(GPIO, HIGH);
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
}
else if (state == BLINKER_CMD_ON) {
digitalWrite(GPIO, LOW);
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
}
}
void setup() {
Serial.begin(115200);
pinMode(GPIO,OUTPUT);
digitalWrite(GPIO,HIGH);
Blinker.begin(auth, ssid, pswd);
Button1.attach(button1_callback);
BlinkerMIOT.attachPowerState(miotPowerState);
}
void loop()
{
Blinker.run();
}
问题解决了吗,我现在也遇到这个问题,几天了 少了 BlinkerMIOT.attachQuery(miotQuery);
请使用例程测试
页:
[1]