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

1361139229 发表于 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);
}
按照例程走的   温湿度能读取出来但是表没曲线
这样配置有什么问题么?为什么图标没数据的?

点灯官方 发表于 2021-11-2 10:26

https://www.arduino.cn/thread-84332-1-1.html
看看调试信息

1361139229 发表于 2021-11-2 14:33

点灯官方 发表于 2021-11-2 10:26
https://www.arduino.cn/thread-84332-1-1.html
看看调试信息

Temperature: 26.20 *C
Got: {"fromDevice":"b3df327d213011ec83b15254","data":{"rt":["humi","tem","num-abd","temp"]}}
data: {"rt":["humi","tem","num-abd","temp"]}
fromDevice: b3df327d213011ec83b15254
Authority uuid
available: 1
checkAvail: 1
parse data: {"rt":["humi","tem","num-abd","temp"]}
defined BLINKER_ARDUINOJSON
autoManager begin: 0 0
get_key: null
flush
Humidity: 61.00 %
Temperature: 26.20 *C
Humidity: 61.00 %
请问有什么问题么?? 我知识水平有限,看不出有什么问题请不吝赐教,感谢   图表还是没数据传输

点灯官方 发表于 2021-11-2 21:14

1361139229 发表于 2021-11-2 14:33
Temperature: 26.20 *C
Got: {"fromDevice":"b3df327d213011ec83b15254","data":{"r ...

看起来,你运行的都不是你一楼贴的程序。
页: [1]
查看完整版本: 点灯科技表格无法读取