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

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 470|回复: 5

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

[复制链接]
发表于 2022-9-24 09:51 | 显示全部楼层 |阅读模式
遇到个非常奇怪的问题,一个最简单的上线程序,开手机热点就可以上线,连WIFI 2.4G  就是上不了线。开始以为是路由器的问题,找了个以前的路由器试了一次,还是上不了线,不知道是什么情况,宽带是联通的。


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

[105] Connecting to eff
[110] ESP8266_MQTT initialized...
[110]
===========================================================
================== Blinker Timer loaded! ==================
     EEPROM address 1536-2431 is used for Blinker Timer!
========= PLEASE AVOID USING THESE EEPROM ADDRESS! ========
===========================================================

[249850] WiFi Connected.
[249851] IP Address:
[249851] xxx.xxx.xxx.xxx
[249862] [HTTP] GET... failed, error: connection failed
[249862]
[249863] ERROR: Maybe you have put in the wrong AuthKey!
[249863] ERROR: Or maybe your request is too frequently!
[249867] ERROR: Or maybe your network is disconnected!
[259869] [HTTP] GET... failed, error: connection failed
[259869]
[259869] ERROR: Maybe you have put in the wrong AuthKey!

 楼主| 发表于 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();
发表于 2022-9-24 13:04 | 显示全部楼层
[HTTP] GET... failed, error: connection failed
连不上网,自己检查网络吧
 楼主| 发表于 2022-9-24 13:47 | 显示全部楼层
如果是宽带问题那就简单了,主要是宽带正常,WIFI正常,从路由器后台能看到ESP模块已经连上了

点评

连上了路由器,不等于连上了互联网。这个报错就是说没连上互联网,或者是DNS等原因造成的网络不通。这个不是blinker这边的问题,只有你自己排查了。  详情 回复 发表于 2022-9-24 18:05
发表于 2022-9-24 18:05 | 显示全部楼层
djdyaqb 发表于 2022-9-24 13:47
如果是宽带问题那就简单了,主要是宽带正常,WIFI正常,从路由器后台能看到ESP模块已经连上了 ...

连上了路由器,不等于连上了互联网。这个报错就是说没连上互联网,或者是DNS等原因造成的网络不通。这个不是blinker这边的问题,只有你自己排查了。
 楼主| 发表于 2022-9-30 16:41 | 显示全部楼层
Download latest blinker library here!
    => https://github.com/blinker-iot/blinker-library

[104] Connecting to fei
[109] ESP8266_MQTT initialized...
[109]
===========================================================
================== Blinker Timer loaded! ==================
     EEPROM address 1536-2431 is used for Blinker Timer!
========= PLEASE AVOID USING THESE EEPROM ADDRESS! ========
===========================================================

[4359] WiFi Connected.
[4359] IP Address:
[4359] 192.168.1.171
[4570] Freeheap: 36456
[4572] mDNS responder started
[4573] webSocket_MQTT server started
[4573] ws://438752FD9VK8QQRUTQ4JL965.local:81

这个应该是连上互联网了吧?还是不上线,但是把wifi关了,开同样名称的手机热点能上线,实在是找不到原因了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-28 09:40 , Processed in 0.097562 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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