点灯科技表格无法读取-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1287|回复: 4

[已解答] 点灯科技表格无法读取

[复制链接]
发表于 2021-11-2 00:09 | 显示全部楼层 |阅读模式
#define BLINKER_WIFI
#define BLINKER_MIOT_SENSOR

#include <Blinker.h>
#include <DHT.h>

char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";

BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");

#define DHTPIN D7

//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);

int humi_read = 0, temp_read = 0;

void heartbeat()
{
    HUMI.print(humi_read);
    TEMP.print(temp_read);
}

void dataStorage()
{
    Blinker.dataStorage("temp", temp_read);
    Blinker.dataStorage("humi", humi_read);
}

void miotQuery(int32_t queryCode)
{
    BLINKER_LOG("MIOT Query codes: ", queryCode);

    switch (queryCode)
    {
        case BLINKER_CMD_QUERY_ALL_NUMBER :
            BLINKER_LOG("MIOT Query All");
            BlinkerMIOT.temp(temp_read);
            BlinkerMIOT.humi(humi_read);
            BlinkerMIOT.print();
            break;
        default :
            BlinkerMIOT.temp(20);
            BlinkerMIOT.humi(20);
            break;
    }
}

void setup()
{
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
    // BLINKER_DEBUG.debugAll();
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);

    Blinker.begin(auth, ssid, pswd);
    Blinker.attachHeartbeat(heartbeat);
    Blinker.attachDataStorage(dataStorage);
    BlinkerMIOT.attachQuery(miotQuery);
    dht.begin();
}

void loop()
{
    Blinker.run();

    int h = dht.readHumidity();
    int t = dht.readTemperature();

    if (isnan(h) || isnan(t))
    {
        BLINKER_LOG("Failed to read from DHT sensor!");
    }
    else
    {
        humi_read = h;
        temp_read = t;
    }

    Blinker.delay(2000);
}
按照例程走的   温湿度能读取出来  但是表没曲线
这样配置有什么问题么?为什么图标没数据的?
058EBA2ECFDE403977D3AEC4F9493C0E.JPG
发表于 2021-11-2 10:26 | 显示全部楼层
 楼主| 发表于 2021-11-2 14:33 | 显示全部楼层
点灯官方 发表于 2021-11-2 10:26
https://www.arduino.cn/thread-84332-1-1.html
看看调试信息

[3904281] Temperature: 26.20 *C
[3904754] Got: {"fromDevice":"b3df327d213011ec83b15254","data":{"rt":["humi","tem","num-abd","temp"]}}
[3904755] data: {"rt":["humi","tem","num-abd","temp"]}
[3904756] fromDevice: b3df327d213011ec83b15254
[3904761] Authority uuid
[3904783] available: 1
[3904783] checkAvail: 1
[3904783] parse data: {"rt":["humi","tem","num-abd","temp"]}
[3904783] defined BLINKER_ARDUINOJSON
[3904785] autoManager begin: 0 0
[3904788] get_key: null
[3904791] flush
[3906329] Humidity: 61.00 %
[3906329] Temperature: 26.20 *C
[3908383] Humidity: 61.00 %
请问有什么问题么?? 我知识水平有限,看不出有什么问题  请不吝赐教,感谢   图表还是没数据传输
发表于 2021-11-2 21:14 | 显示全部楼层
1361139229 发表于 2021-11-2 14:33
[3904281] Temperature: 26.20 *C
[3904754] Got: {"fromDevice":"b3df327d213011ec83b15254","data":{"r ...

看起来,你运行的都不是你一楼贴的程序。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-28 11:43 , Processed in 0.106924 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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