用ESP8266-01添加小爱同学语音控制的时候提示无网络连接-Arduino中文社区 - Powered by Discuz! Archiver

fan183579 发表于 2021-3-12 15:27

用ESP8266-01添加小爱同学语音控制的时候提示无网络连接

1.在添加语音控制的几段代码前功能正常
2.做测试用只在烧录器上读取串口信息
附上串口调试信息:
===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================

WiFi Connected.
IP Address:
192.168.188.108
ERROR: Maybe you have put in the wrong AuthKey!
ERROR: Or maybe your request is too frequently!
ERROR: Or maybe your network is disconnected!
ERROR: Maybe you have put in the wrong AuthKey!
ERROR: Or maybe your request is too frequently!
ERROR: Or maybe your network is disconnected!



然后就一直循环三句话
ERROR: Maybe you have put in the wrong AuthKey!
ERROR: Or maybe your request is too frequently!
ERROR: Or maybe your network is disconnected!



求助原因

fan183579 发表于 2021-3-12 15:28

#define BLINKER_WIFI
#define BLINKER_MIOT_LIGHT
#include <Blinker.h>

char auth[] = "6c52cc430f63";
char ssid[] = "***";
char pswd[] = "************";

// 新建组件对象
BlinkerButton Button1("btn-be4");

// 按下按键即会执行该函数
void button1_callback(const String & state)
{
    BLINKER_LOG("get button state: ", state);
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    //控制继电器
    digitalWrite(0, !digitalRead(0));
    Serial.println("我收到了");
}

void miotPowerState(const String & state)
{
    BLINKER_LOG("need set power state: ", state);

    if (state == BLINKER_CMD_ON) {
      digitalWrite(LED_BUILTIN, LOW);

      BlinkerMIOT.powerState("on");
      BlinkerMIOT.print();
    }
    else if (state == BLINKER_CMD_OFF) {
      digitalWrite(LED_BUILTIN, HIGH);

      BlinkerMIOT.powerState("off");
      BlinkerMIOT.print();
    }
}

void setup()
{
    // 初始化串口
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
   
    // 初始化有LED的IO
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);

    //控制继电器
    pinMode(0, OUTPUT);
    digitalWrite(0, HIGH);   
   
    // 初始化blinker
    Blinker.begin(auth, ssid, pswd);
    Button1.attach(button1_callback);
    BlinkerMIOT.attachPowerState(miotPowerState);
}

void loop() {
    Blinker.run();
}

Sn5dxlx 发表于 2021-4-5 14:06

你好,我测试了你的代码,是可以运行的如果你想语言控制继电器的话,把 digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));删掉,下面的digitalWrite(LED_BUILTIN, LOW);改为
digitalWrite(0, LOW);和digitalWrite(0, HIGH);因为继电器是gpio0,1口控制的。然后确保你的blinker库为最新,如果实在不行测试奈何col在点灯里面的历程.
页: [1]
查看完整版本: 用ESP8266-01添加小爱同学语音控制的时候提示无网络连接