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

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1878|回复: 2

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

[复制链接]
发表于 2021-3-12 15:27 | 显示全部楼层 |阅读模式
1.在添加语音控制的几段代码前功能正常
2.做测试用只在烧录器上读取串口信息
附上串口调试信息:
===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================

[638] WiFi Connected.
[638] IP Address:
[639] 192.168.188.108
[751] ERROR: Maybe you have put in the wrong AuthKey!
[751] ERROR: Or maybe your request is too frequently!
[751] ERROR: Or maybe your network is disconnected!
[10734] ERROR: Maybe you have put in the wrong AuthKey!
[10734] ERROR: Or maybe your request is too frequently!
[10735] ERROR: Or maybe your network is disconnected!



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



求助原因
 楼主| 发表于 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();
}
发表于 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在点灯里面的历程.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 13:41 , Processed in 0.070668 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表