|
本帖最后由 chinaatom 于 2020-8-10 11:03 编辑
blinker 2.4.7
请教
昨天用esp8266 APP用的blinker2.4.4,上传温湿度,实时数据可见。使用图表曲线控件也正常。今天升级成blinker 2.4.7 , 图表历史数据不显示了,也就是不能显示历史数据 。是限制了吗?需要购买专业版??
#define BLINKER_WIFI
#define BLINKER_ALIGENIE_SENSOR
#include <Blinker.h>
#include <DHT.h>
char auth[] = "xxx";//ESP8266-01
char ssid[] = "xxx";
char pswd[] = "xxx";
BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");
#define DHTPIN D9
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
float 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 aligenieQuery(int32_t queryCode)
{
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("AliGenie Query All");
BlinkerAliGenie.temp(temp_read);
BlinkerAliGenie.humi(humi_read);
BlinkerAliGenie.print();
break;
case BLINKER_CMD_QUERY_TEMP_NUMBER :
BlinkerAliGenie.temp(temp_read);
BlinkerAliGenie.print();
break;
case BLINKER_CMD_QUERY_HUMI_NUMBER :
BlinkerAliGenie.humi(humi_read);
BlinkerAliGenie.print();
break;
default :
BlinkerAliGenie.temp(20);
BlinkerAliGenie.humi(20);
BlinkerAliGenie.print();
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);
BlinkerAliGenie.attachQuery(aligenieQuery);
Blinker.attachDataStorage(dataStorage);
dht.begin();
}
void loop()
{
Blinker.run();
float h = dht.readHumidity();
float t = dht.readTemperature();
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;
temp_read = t;
}
Blinker.delay(2000);
}
|
-
|