Skip to content

Commit a6b6217

Browse files
committed
update codes, upgrade BLINKER RT DATA codes & example.
1 parent 1e3f352 commit a6b6217

File tree

5 files changed

+442
-126
lines changed

5 files changed

+442
-126
lines changed

examples/Blinker_Cloud/Blinker_CLOUDDATA/CLOUDDATA_WiFi/CLOUDDATA_WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ void setup()
8585
void loop()
8686
{
8787
Blinker.run();
88-
}
88+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* *****************************************************************
2+
*
3+
* Download latest Blinker library here:
4+
* https://github.com/blinker-iot/blinker-library/archive/master.zip
5+
*
6+
*
7+
* Blinker is a cross-hardware, cross-platform solution for the IoT.
8+
* It provides APP, device and server support,
9+
* and uses public cloud services for data transmission and storage.
10+
* It can be used in smart home, data monitoring and other fields
11+
* to help users build Internet of Things projects better and faster.
12+
*
13+
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
14+
* if use ESP8266 with Blinker.
15+
* https://github.com/esp8266/Arduino/releases
16+
*
17+
* Make sure installed 1.0.5 or later ESP32/Arduino package,
18+
* if use ESP32 with Blinker.
19+
* https://github.com/espressif/arduino-esp32/releases
20+
*
21+
* Docs: https://diandeng.tech/doc
22+
*
23+
*
24+
* *****************************************************************
25+
*
26+
* Blinker 库下载地址:
27+
* https://github.com/blinker-iot/blinker-library/archive/master.zip
28+
*
29+
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
30+
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
31+
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
32+
*
33+
* 如果使用 ESP8266 接入 Blinker,
34+
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
35+
* https://github.com/esp8266/Arduino/releases
36+
*
37+
* 如果使用 ESP32 接入 Blinker,
38+
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
39+
* https://github.com/espressif/arduino-esp32/releases
40+
*
41+
* 文档: https://diandeng.tech/doc
42+
*
43+
*
44+
* *****************************************************************/
45+
46+
#define BLINKER_WIFI
47+
48+
#include <Blinker.h>
49+
50+
char auth[] = "Your Device Secret Key";
51+
char ssid[] = "Your WiFi network SSID or name";
52+
char pswd[] = "Your WiFi network WPA password or WEP key";
53+
54+
void dataRead(const String & data)
55+
{
56+
BLINKER_LOG("Blinker readString: ", data);
57+
58+
uint32_t BlinkerTime = millis();
59+
60+
Blinker.vibrate();
61+
Blinker.print("millis", BlinkerTime);
62+
63+
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
64+
}
65+
66+
void rtData()
67+
{
68+
Blinker.RTDataStorage("data1", (int32_t)random(0,120));
69+
Blinker.RTDataStorage("data2", random(0,120)/(float)1.5);
70+
Blinker.RTDataPrint();
71+
}
72+
73+
void setup()
74+
{
75+
Serial.begin(115200);
76+
BLINKER_DEBUG.stream(Serial);
77+
78+
pinMode(LED_BUILTIN, OUTPUT);
79+
digitalWrite(LED_BUILTIN, LOW);
80+
81+
Blinker.begin(auth, ssid, pswd);
82+
Blinker.attachData(dataRead);
83+
Blinker.attachRTData(rtData);
84+
}
85+
86+
void loop()
87+
{
88+
Blinker.run();
89+
}

0 commit comments

Comments
 (0)