各位大佬求救啊,binker存储数据,编译时出错-Arduino中文社区 - Powered by Discuz! Archiver

liuchengqi1017 发表于 2020-2-10 20:33

各位大佬求救啊,binker存储数据,编译时出错

为什么binker存储数据 代码编译错误
这是报错:class BlinkerESPMQTT' has no member named 'attachDataStorage
这是代码:
#define BLINKER_WIFI
#define BLINKER_ALIGENIE_SENSOR
#include <Blinker.h>
#include <modules/dht/DHT.h>

char auth[] = "de1d2652e54c";
char ssid[] = "smp";
char pswd[] = "12345679";

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



#define DHTPIN D4
#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,SMS_read;

void heartbeat()
{
    SMS.print(SMS_read);
    HUMI.print(humi_read);
    TEMP.print(temp_read);
}
void dataStorage()
{
    Blinker.dataStorage("temp", temp_read);
    Blinker.dataStorage("humi", humi_read);
    Blinker.dataStorage("SMS", SMS_read);
}

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);
    dht.begin();
}

void loop()
{
    Blinker.run();
    float SMS =analogRead(0);
    float h = dht.readHumidity();
    float t = dht.readTemperature();

    if (isnan(h) || isnan(t))
    {
      BLINKER_LOG("Failed to read from DHT sensor!");
    }
    else
    {
      BLINKER_LOG("soil moisture",SMS,"%");   
      BLINKER_LOG("Humidity: ", h, " %");
      BLINKER_LOG("Temperature: ", t, " *C");
      humi_read = h;
      temp_read = t;
      SMS_read=SMS;
    }

    Blinker.delay(2000);
}

a7178636965 发表于 2020-2-15 11:40

BlinkerMIOT.attachQuery(miotQuery);我的这句话是橙黄色的,你的是不是库有问题?

a7178636965 发表于 2020-2-15 11:42

这样的

奈何col 发表于 2020-2-15 11:54

确保lib为最新,确保你使用的是8266或esp32

凤凰de星空 发表于 2020-4-11 16:34

本帖最后由 凤凰de星空 于 2020-4-11 16:41 编辑

解决了吗,我也遇到了这个问题

'class BlinkerSerialESPMQTT' has no member named 'dataStorage'; did you mean '_dataStorageFunc'?
页: [1]
查看完整版本: 各位大佬求救啊,binker存储数据,编译时出错