【求助】esp8266+blinker网络温湿度计手机端显示离线-Arduino中文社区 - Powered by Discuz! Archiver

zsy1 发表于 2020-8-28 17:33

【求助】esp8266+blinker网络温湿度计手机端显示离线

第一次使用blinker,参考https://blog.csdn.net/JIANGYINGH/article/details/105007516制作网络温湿度计,上传程序等正常,esp8266可以连接网络(见下图),但是手机端显示离线,麻烦大佬指点,谢谢。
附图片:

奈何col 发表于 2020-8-28 20:58

https://www.arduino.cn/thread-95396-1-1.html

XlinliY.Zhang 发表于 2020-8-29 13:51

看串口输出什么吧

zsy1 发表于 2020-8-30 12:32

XlinliY.Zhang 发表于 2020-8-29 13:51
看串口输出什么吧

Humidity: 67.00 %
Temperature: 29.00 *C
WiFi Connected.
IP Address:
192.168.3.20
Humidity: 67.00 %
Temperature: 29.00 *C
begin: https://iot.diandeng.tech/api/v1/user/device/diy/auth?authKey=27d156e29025&miType=sensor
GET... code: 200
reply was:
==============================
{"detail": {"broker": "blinker", "deviceName": "320BC22827JTMM5WN38OMWO7", "host": "mqtt://broker.diandeng.tech", "iotId": "4tBPUWDbDgSN5mgNscqfxjTLbx", "iotToken": "Q8p5VmogfsbuHMrYSnuMNUxFm2EDBpid", "port": "1883", "productKey": "blinker", "uuid": "b55eff7fe6d111ea9a675254"}, "message": 1000}
==============================
====================
DEVICE_NAME_MQTT:
MQTT_PRODUCTINFO_MQTT:
MQTT_ID_MQTT:
MQTT_NAME_MQTT:
MQTT_KEY_MQTT:
MQTT_BROKER: blinker
HOST:
PORT: 0
UUID_MQTT: b55eff7fe6d111ea9a675254
====================

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (28):
epc1=0x4022211c epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000424 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffb90 end: 3fffffc0 offset: 0190
3ffffd20:3fff91ec 3fff0228 3fff0224 4020ae26
3ffffd30:00000000 00000000 3fff3474 3fff35d4
3ffffd40:0011001f 00000030 000101bb ff001388
3ffffd50:3fff3964 003f003f 00000000 70747468
3ffffd60:60000073 85000004 3fff356c 0000001f
3ffffd70:00ffffff 3fff32f4 0011001f 00fef7cc
3ffffd80:3fffff00 3fffff80 80ff09d8 00000000
3ffffd90:00000000 00000000 ffffffff 00000001
3ffffda0:00000000 3ffe000a 00000000 40100977
3ffffdb0:80253da4 00000000 00000000 3fff8b00
3ffffdc0:3fff8de4 3fff8ecd 3fff9144 3fff91e4
3ffffdd0:3fff91d4 3fff9144 4bc6a7a0 6e696c00
3ffffde0:0072656b 809e72fb 3fff3500 0010001f
3ffffdf0:80000000 00455a1c 3fff0a38 00000000
3ffffe00:3fff8bac 0018001f 00000014 6e696c62
3ffffe10:0072656b 87ff0a38 6e696c62 0072656b
3ffffe20:87fef838 3fff8b74 0020002f 0021d5ed
3ffffe30:3fff32c4 001a001f 00fef7cc 3fff3544
3ffffe40:0018001f 0000001e 3fff8cac 0127012f
3ffffe50:00000000 3fff38fc 0058005f 00000000
3ffffe60:3fff31f4 003b003f 00c6a7f0 3fff33dc
3ffffe70:0011001f 0000006f 4010047c 000038f2
3ffffe80:3ffffdd0 3ffffdc0 00000000 3fff3474
3ffffe90:3fff3594 00000000 3fff205d 40221119
3ffffea0:3ffffee2 00000025 00000054 3ffef838
3ffffeb0:000007d0 00000000 3ffefd04 4020af54
3ffffec0:00000002 00000000 3ffefd04 4020b10d
3ffffed0:3fffff35 00000000 00000030 40221119
3ffffee0:3fffff35 00000030 3fffff30 0000002e
3ffffef0:3ffe92c9 00000000 5d5b000a 40221119
3fffff00:000007d0 00de74e7 3ffefd04 4020b14e
3fffff10:000007d0 00de74e7 3ffef838 4020f58c
3fffff20:4021de7c 3fff087c 4010047c 000038f2
3fffff30:00000000 3fff087c 3ffe92c7 402115bd
3fffff40:0041d8e0 3ffe8b53 3fff0338 4021e2c4
3fffff50:41e80000 3ffe8b53 3fff0338 3ffef838
3fffff60:000007d0 00de74e7 000007d0 4020f9a5
3fffff70:000038f2 3ffe8b53 3fff0338 40205a42
3fffff80:3ffef838 42860000 3fff0338 3fff09d8
3fffff90:3ffef838 42860000 41e80000 4020fa4a
3fffffa0:3fffdad0 00000000 3fff0998 4021fe6c
3fffffb0:feefeffe feefeffe 3ffe85bc 40100eb5
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan8 2013,rst cause:1, boot mode:(3,6)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld


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

_aliType:
_duerType:
_miType: &miType=sensor
_authKey: 27d156e29025
Connecting to zth
ESP8266_MQTT initialized...

===========================================================
================== Blinker Timer loaded! ==================
Warning!EEPROM address 1536-2431 is used for Blinker Timer!
============= DON'T USE THESE EEPROM ADDRESS! =============
===========================================================

countdown state: false
_cdRunState: 0
_totalTime: 0
_runTime: 0
_action:
loop state: false
_lpRunState: 0
_times: 0
_tri_times: 0
_time1: 0
_action1:
_time2: 0
_action2:
_lpData: 0
Humidity: 67.00 %
Temperature: 29.00 *C
Humidity: 67.00 %
Temperature: 29.00 *C
Humidity: 66.00 %
Temperature: 29.00 *C
Humidity: 66.00 %
Temperature: 29.00 *C
WiFi Connected.
IP Address:
192.168.3.20
begin: https://iot.diandeng.tech/api/v1/user/device/diy/auth?authKey=27d156e29025&miType=sensor
GET... code: 200
reply was:
==============================
{"detail": {"broker": "blinker", "deviceName": "320BC22827JTMM5WN38OMWO7", "host": "mqtt://broker.diandeng.tech", "iotId": "GHBxHgJyYxdmsiRVjcrNXPNirq", "iotToken": "KZfpn2kXWuQyzBH3nwHz7uuRSqmnzhez", "port": "1883", "productKey": "blinker", "uuid": "b55eff7fe6d111ea9a675254"}, "message": 1000}
==============================
====================
DEVICE_NAME_MQTT:
MQTT_PRODUCTINFO_MQTT:
MQTT_ID_MQTT:
MQTT_NAME_MQTT:
MQTT_KEY_MQTT:
MQTT_BROKER: blinker
HOST:
PORT: 0
UUID_MQTT: b55eff7fe6d111ea9a675254
====================

XlinliY.Zhang 发表于 2020-8-30 12:42

zsy1 发表于 2020-8-30 12:32
Humidity: 67.00 %
Temperature: 29.00 *C
WiFi Connected.


好像都没有正常启动

zsy1 发表于 2020-8-30 12:50

奈何col 发表于 2020-8-28 20:58
https://www.arduino.cn/thread-95396-1-1.html

我后来又做了https://www.bilibili.com/video/BV1JE411J77j?from=search&seid=17407873450485934984上传程序、连网正常,但APP也显示离线。我按照链接里面的方法试过了但是没有用,我觉得可能是我手机APP设置的问题,我重新设置了一下,过程录了屏。因为没法上传视频,我只好上传到百度网盘上,麻烦看一下哪里错了,谢谢。顺便附上了其他过程的一些图片,麻烦看一下链接:https://pan.baidu.com/s/1hRB-kL6zlqaTpzc-vBZNVA 提取码:0o52

zsy1 发表于 2020-8-30 12:54

XlinliY.Zhang 发表于 2020-8-30 12:42
好像都没有正常启动

麻烦详细解释一下,谢谢。我都是按照教程来的呀::'(:L

#define BLINKER_WIFI //定义wifi模块
#define BLINKER_MIOT_SENSOR//小爱同学定义为传感器设备
#include <Blinker.h>//包含Blinker头文件
#include <DHT.h>//包含DHT头文件

#define DHTPIN 2      //定义DHT11模块连接管脚io2

#define DHTTYPE DHT11   // 使用温度湿度模块的类型为DHT11

char auth[] = "27d156e29025";//你的设备key
char ssid[] = "***";//你的wifi 名称
char pswd[] = "*********";//你的wifi 密码

//新建数据类型组件对象,作用:将数据传输到手机blinker app
BlinkerNumber HUMI("humi");    //定义湿度数据键名
BlinkerNumber TEMP("temp");    //定义温度数据键名
   
DHT dht(DHTPIN, DHTTYPE);    //生成DHT对象,参数是引脚和DHT的类型

float humi_read = 0, temp_read = 0;//定义浮点型全局变量 储存传感器读取的温湿度数据

void heartbeat()
{
    HUMI.print(humi_read);      //给blinkerapp回传湿度数据
    TEMP.print(temp_read);      //给blinkerapp回传温度数据
}

void miotQuery(int32_t queryCode)      //小爱同学语音命令反馈
{
    BLINKER_LOG("MIOT Query codes: ", queryCode);

            int humi_read_int=humi_read;   //去掉湿度浮点数
            BlinkerMIOT.humi(humi_read_int); //小爱反馈湿度属性
            BlinkerMIOT.temp(temp_read);   //小爱反馈温度属性
            BlinkerMIOT.print();//将以上属性发送给小爱,使得小爱可以接收到温湿度的数据

}


void setup()//将设置代码放在此处,运行一次;
{
    //初始化端口
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
    BLINKER_DEBUG.debugAll();

    Blinker.begin(auth, ssid, pswd); // // 初始化blinker
    Blinker.attachHeartbeat(heartbeat);//将传感器获取的数据传给blinker app上
    dht.begin();//初始化DHT传感器
    //在回调函数中反馈该控制状态
    BlinkerMIOT.attachQuery(miotQuery);//每次呼出小爱同学,就会调用miotQuery()函数
}
//通过循环不断读取温湿度传感器获取的数据
void loop() //把主代码放在这里,重复运行:
{
    Blinker.run();//运行Blinker

    float h = dht.readHumidity();//读取DHT11传感器的湿度 并赋值给h
    float t = dht.readTemperature();//读取传感器的温度   并赋值给t
    if (isnan(h) || isnan(t))//判断是否成功读取到温湿度数据
    {
      BLINKER_LOG("Failed to read from DHT sensor!");//读取温湿度失败!
    }
    else//成功读取到数据
    {   
      //打印
      BLINKER_LOG("Humidity: ", h, " %");
      BLINKER_LOG("Temperature: ", t, " *C");
      
      humi_read = h;//将读取到的湿度赋值给全局变量humi_read
      temp_read = t;//将读取到的温度赋值给全局变量temp_read
    }
    Blinker.delay(2000);//延时函数
}
页: [1]
查看完整版本: 【求助】esp8266+blinker网络温湿度计手机端显示离线