esp8266 wifi接入app显示设备离线,手机开热点就可以上线-Arduino中文社区 - Powered by Discuz! Archiver

djdyaqb 发表于 2022-9-24 09:51

esp8266 wifi接入app显示设备离线,手机开热点就可以上线

遇到个非常奇怪的问题,一个最简单的上线程序,开手机热点就可以上线,连WIFI 2.4G就是上不了线。开始以为是路由器的问题,找了个以前的路由器试了一次,还是上不了线,不知道是什么情况,宽带是联通的。


\ \_\ \_\ \____\\ \_\
    \/___/   \/__/ \/_/\/_/\/_/\/_/\/_/\/____/ \/_/
    To better use blinker with your IoT project!
    Download latest blinker library here!
    => https://github.com/blinker-iot/blinker-library

Connecting to eff
ESP8266_MQTT initialized...

===========================================================
================== Blinker Timer loaded! ==================
   EEPROM address 1536-2431 is used for Blinker Timer!
========= PLEASE AVOID USING THESE EEPROM ADDRESS! ========
===========================================================

WiFi Connected.
IP Address:
xxx.xxx.xxx.xxx
GET... failed, error: connection failed

ERROR: Maybe you have put in the wrong AuthKey!
ERROR: Or maybe your request is too frequently!
ERROR: Or maybe your network is disconnected!
GET... failed, error: connection failed

ERROR: Maybe you have put in the wrong AuthKey!

djdyaqb 发表于 2022-9-24 10:11

#define BLINKER_WIFI

#include <Blinker.h>

char auth[] = "XXXXXXXXX";//替代为你的密匙
char ssid[] = "eff"; //2.4Gwifi名称,可以是手机热点,不要有中文
char pswd[] = "12345678";//WiFi密码
byte LED =14;
// 新建组件对象
BlinkerButton Button1("btn-g7m");//ON
BlinkerButton Button2("btn-i7m");//OFF
// 按下按键即会执行该函数
void button1_callback(const String & state) {   //回调函数
    BLINKER_LOG("get button state: ", state);
    digitalWrite(LED,HIGH);
    //Blinker.vibrate();
}

void button2_callback(const String & state) {   //回调函数
    BLINKER_LOG("get button state: ", state);
    digitalWrite(LED,LOW);
    //Blinker.vibrate();
}


void setup() {
    // 初始化串口,并开启调试信息,项目成型后可关闭
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
    // 初始化有LED的IO
    pinMode(LED, OUTPUT);
    digitalWrite(LED, HIGH);
    // 初始化blinker
    Blinker.begin(auth, ssid, pswd);
    Button1.attach(button1_callback);//绑定回调函数
    Button2.attach(button2_callback);
}

void loop() {
    Blinker.run();

奈何col 发表于 2022-9-24 13:04

GET... failed, error: connection failed
连不上网,自己检查网络吧

djdyaqb 发表于 2022-9-24 13:47

如果是宽带问题那就简单了,主要是宽带正常,WIFI正常,从路由器后台能看到ESP模块已经连上了

奈何col 发表于 2022-9-24 18:05

djdyaqb 发表于 2022-9-24 13:47
如果是宽带问题那就简单了,主要是宽带正常,WIFI正常,从路由器后台能看到ESP模块已经连上了 ...

连上了路由器,不等于连上了互联网。这个报错就是说没连上互联网,或者是DNS等原因造成的网络不通。这个不是blinker这边的问题,只有你自己排查了。

djdyaqb 发表于 2022-9-30 16:41

Download latest blinker library here!
    => https://github.com/blinker-iot/blinker-library

Connecting to fei
ESP8266_MQTT initialized...

===========================================================
================== Blinker Timer loaded! ==================
   EEPROM address 1536-2431 is used for Blinker Timer!
========= PLEASE AVOID USING THESE EEPROM ADDRESS! ========
===========================================================

WiFi Connected.
IP Address:
192.168.1.171
Freeheap: 36456
mDNS responder started
webSocket_MQTT server started
ws://438752FD9VK8QQRUTQ4JL965.local:81

这个应该是连上互联网了吧?还是不上线,但是把wifi关了,开同样名称的手机热点能上线,实在是找不到原因了:dizzy:
页: [1]
查看完整版本: esp8266 wifi接入app显示设备离线,手机开热点就可以上线