|
求助!数据能够传输到app端但是数据组件不能显示实时数据
源代码
#define BLINKER_BLE
//#define humi "NUMKey"
//#define temp "NUMKey"
#include <Blinker.h>
#include <dht11.h>
BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");
#define DHTPIN A5
#define DHTTYPE dht11 // DHT 11
//dht11 dht(DHTPIN, DHTTYPE);
dht11 DHT11;
double humi_read = 25, temp_read = 70;
void heartbeat()
{
HUMI.print(humi_read);
TEMP.print(temp_read);
}
void setup()
{
Serial.begin(9600);
BLINKER_DEBUG.stream(Serial);
BLINKER_DEBUG.debugAll();
// Blinker.attachHeartbeat(heartbeat);
Blinker.begin(2,3,9600);
}
void loop()
{
Blinker.run();
DHT11.read(DHTPIN);
double h = DHT11.humidity;
double t = DHT11.temperature;
if (isnan(h) || isnan(t))
{
BLINKER_LOG("Failed to readfrom DHT sensor!");
}
else
{
BLINKER_LOG("Humidity: ", h, " %");
BLINKER_LOG("Temperature: ", t, " ℃");
humi_read = h;
temp_read = t;
}
Blinker.delay(20000);
}
错误信息
In file included from D:\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:25:0,
from D:\Arduino\libraries\blinker-library-master\src/Blinker.h:21,
from C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino:4:
D:\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h: In member function 'virtual char* BlinkerSerial::lastRead()':
D:\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h:36:75: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char * lastRead() { if (isFresh) return streamData; else return ""; }
^~
In file included from D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,
from D:\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26,
from D:\Arduino\libraries\blinker-library-master\src/Blinker.h:21,
from C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino:4:
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:234:86: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char* dataParse() { if (canParse) return conn->lastRead(); else return ""; }
^~
In file included from D:\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26:0,
from D:\Arduino\libraries\blinker-library-master\src/Blinker.h:21,
from C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino:4:
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:777:97: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);
^
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7012:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
else return "";
^~
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_joy(uint8_t)':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7019:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
else return "";
^~
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7026:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
else return "";
^~
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7032:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
else return "";
^~
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':
D:\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7038:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
else return "";
^~
C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino: At global scope:
C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino:6:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
BlinkerNumber HUMI("humi");
^
C:\Users\Administrator\Desktop\sketch_may29a\sketch_may29a.ino:7:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
BlinkerNumber TEMP("temp");
^
|
|