初始化提交
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_PRO_ESP
|
||||
#define BLINKER_BUTTON
|
||||
#if defined(ESP32)
|
||||
#define BLINKER_BUTTON_PIN 4
|
||||
#else
|
||||
#define BLINKER_BUTTON_PIN D7
|
||||
#endif
|
||||
|
||||
#define BLINKER_OTA_VERSION_CODE "0.1.1"
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
char type[] = "Your Device Type";
|
||||
char auth[] = "Your Device Secret Key";
|
||||
|
||||
BlinkerButton Button1("btn-abc");
|
||||
BlinkerNumber Number1("num-abc");
|
||||
|
||||
int counter = 0;
|
||||
|
||||
void button1_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get button state: ", state);
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
/*
|
||||
* Add your command parse code in this function
|
||||
*
|
||||
* When get a command and device not parsed this command, device will call this function
|
||||
*/
|
||||
bool dataParse(const JsonObject & data)
|
||||
{
|
||||
String getData;
|
||||
|
||||
serializeJson(data, getData);
|
||||
|
||||
BLINKER_LOG("Get user command: ", getData);
|
||||
|
||||
// if you parsed this data, return TRUE.
|
||||
// return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add your heartbeat message detail in this function
|
||||
*
|
||||
* When get heartbeat command {"get": "state"}, device will call this function
|
||||
* For example, you can print message back
|
||||
*
|
||||
* Every 30s will get a heartbeat command from app
|
||||
*/
|
||||
void heartbeat()
|
||||
{
|
||||
BLINKER_LOG("heartbeat!");
|
||||
}
|
||||
|
||||
#if defined(BLINKER_BUTTON)
|
||||
/*
|
||||
* Blinker provide a button parse function for user if you defined BLINKER_BUTTON
|
||||
*
|
||||
* Blinker button can detect singal click/ double click/ long press
|
||||
*
|
||||
* Blinker.tick() will run by default, use interrupt will be better
|
||||
*/
|
||||
ICACHE_RAM_ATTR void buttonTick()
|
||||
{
|
||||
Blinker.tick();
|
||||
}
|
||||
|
||||
/*
|
||||
* Add your code in this function
|
||||
*
|
||||
* When button clicked, device will call this function
|
||||
*/
|
||||
void singleClick()
|
||||
{
|
||||
BLINKER_LOG("Button clicked!");
|
||||
}
|
||||
|
||||
/*
|
||||
* Add your code in this function
|
||||
*
|
||||
* When button double clicked, device will call this function
|
||||
*/
|
||||
void doubleClick()
|
||||
{
|
||||
BLINKER_LOG("Button double clicked!");
|
||||
}
|
||||
#endif
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
counter++;
|
||||
Number1.print(counter);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
BLINKER_DEBUG.debugAll();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, type);
|
||||
Blinker.attachData(dataRead);
|
||||
Blinker.attachParse(dataParse);
|
||||
Blinker.attachHeartbeat(heartbeat);
|
||||
|
||||
Button1.attach(button1_callback);
|
||||
|
||||
#if defined(BLINKER_BUTTON)
|
||||
Blinker.attachClick(singleClick);
|
||||
Blinker.attachDoubleClick(doubleClick);
|
||||
attachInterrupt(BLINKER_BUTTON_PIN, buttonTick, CHANGE);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t run_time = millis();
|
||||
|
||||
uint8_t humis[10] = {19,18,17,18,21,20,19,18,17,16};
|
||||
uint8_t humi_num = 0;
|
||||
|
||||
void auto_check()
|
||||
{
|
||||
if (millis() - run_time >= 10000)
|
||||
{
|
||||
run_time = millis();
|
||||
|
||||
Blinker.autoInput("num-abc", humis[humi_num]);
|
||||
Blinker.autoRun();
|
||||
|
||||
humi_num = (humi_num + 1) % 10;
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
auto_check();
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
/*
|
||||
*
|
||||
* This example not complete at all, TODO.
|
||||
*
|
||||
*/
|
||||
|
||||
#define BLINKER_PRINT Serial
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
BlinkerButton Button1("btn-abc");
|
||||
BlinkerNumber Number1("num-abc");
|
||||
|
||||
int counter = 0;
|
||||
|
||||
bool switch_state = false;
|
||||
BlinkerButton Button1("btn-abc");
|
||||
BlinkerNumber Number1("num-abc");
|
||||
|
||||
int counter = 0;
|
||||
|
||||
bool switch_state = false;
|
||||
|
||||
void button1_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get button state: ", state);
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
counter++;
|
||||
Number1.print(counter);
|
||||
}
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
switch_state = true;
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
switch_state = false;
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
|
||||
Blinker.autoInput("switch", switch_state ? 1.0 : 0.0);
|
||||
Blinker.autoRun();
|
||||
}
|
||||
|
||||
void heartbeat()
|
||||
{
|
||||
if (switch_state) BUILTIN_SWITCH.print("on");
|
||||
else BUILTIN_SWITCH.print("off");
|
||||
|
||||
Number1.print(counter);
|
||||
}
|
||||
|
||||
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.attachData(dataRead);
|
||||
Blinker.attachHeartbeat(heartbeat);
|
||||
|
||||
Button1.attach(button1_callback);
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
Blinker.autoRun();
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define BUTTON_1 "ButtonKey"
|
||||
|
||||
BlinkerButton Button1(BUTTON_1);
|
||||
|
||||
void button1_callback(const String & state)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("get button state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_BUTTON_TAP) {
|
||||
BLINKER_LOG("Button tap!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_BUTTON_PRESSED) {
|
||||
BLINKER_LOG("Button pressed!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_BUTTON_RELEASED) {
|
||||
BLINKER_LOG("Button released!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_ON) {
|
||||
BLINKER_LOG("Toggle on!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print("on");
|
||||
}
|
||||
else if (state == BLINKER_CMD_OFF) {
|
||||
BLINKER_LOG("Toggle off!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print("off");
|
||||
}
|
||||
else {
|
||||
BLINKER_LOG("Get user setting: ", state);
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
Button1.print();
|
||||
}
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Button1.attach(button1_callback);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define BUTTON_1 "ButtonKey"
|
||||
|
||||
BlinkerButton Button1(BUTTON_1);
|
||||
|
||||
void button1_callback(const String & state)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("get button state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_BUTTON_TAP) {
|
||||
BLINKER_LOG("Button tap!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_BUTTON_PRESSED) {
|
||||
BLINKER_LOG("Button pressed!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_BUTTON_RELEASED) {
|
||||
BLINKER_LOG("Button released!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print();
|
||||
}
|
||||
else if (state == BLINKER_CMD_ON) {
|
||||
BLINKER_LOG("Toggle on!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print("on");
|
||||
}
|
||||
else if (state == BLINKER_CMD_OFF) {
|
||||
BLINKER_LOG("Toggle off!");
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print("off");
|
||||
}
|
||||
else {
|
||||
BLINKER_LOG("Get user setting: ", state);
|
||||
|
||||
Button1.icon("icon_1");
|
||||
Button1.color("#FFFFFF");
|
||||
Button1.text("Your button name or describe");
|
||||
// Button1.text("Your button name", "describe");
|
||||
Button1.print();
|
||||
}
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
Button1.attach(button1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
bool switch_state = false;
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
switch_state = true;
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else if (state == BLINKER_CMD_OFF) {
|
||||
switch_state = false;
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
}
|
||||
|
||||
void heartbeat()
|
||||
{
|
||||
if (switch_state) BUILTIN_SWITCH.print("on");
|
||||
else BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
Blinker.attachHeartbeat(heartbeat);
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
bool switch_state = false;
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
switch_state = true;
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else if (state == BLINKER_CMD_OFF) {
|
||||
switch_state = false;
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
}
|
||||
|
||||
void heartbeat()
|
||||
{
|
||||
if (switch_state) BUILTIN_SWITCH.print("on");
|
||||
else BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
|
||||
String summary()
|
||||
{
|
||||
String data = "online, switch: " + STRING_format(switch_state ? "on" : "off");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
Blinker.attachHeartbeat(heartbeat);
|
||||
Blinker.attachSummary(summary);
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
BlinkerButton Button1("btn-abc");
|
||||
BlinkerNumber Number1("num-abc");
|
||||
BlinkerImage Image1("img_abc");
|
||||
|
||||
int counter = 0;
|
||||
|
||||
void image1_callback(int32_t num)
|
||||
{
|
||||
BLINKER_LOG("image is tapped, number is : ", num);
|
||||
}
|
||||
|
||||
void button1_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get button state: ", state);
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
|
||||
Image1.print(digitalRead(LED_BUILTIN) ? 1 : 0);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
counter++;
|
||||
Number1.print(counter);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
BLINKER_DEBUG.debugAll();
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
Button1.attach(button1_callback);
|
||||
Image1.attach(image1_callback);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define JOY_1 "JOYKey"
|
||||
|
||||
BlinkerJoystick JOY1(JOY_1);
|
||||
|
||||
void joystick1_callback(uint8_t xAxis, uint8_t yAxis)
|
||||
{
|
||||
BLINKER_LOG("Joystick1 X axis: ", xAxis);
|
||||
BLINKER_LOG("Joystick1 Y axis: ", yAxis);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
JOY1.attach(joystick1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.5.0 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.2 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.5.0 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.2 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define JOY_1 "JOYKey"
|
||||
|
||||
BlinkerJoystick JOY1(JOY_1);
|
||||
|
||||
void joystick1_callback(uint8_t xAxis, uint8_t yAxis)
|
||||
{
|
||||
BLINKER_LOG("Joystick1 X axis: ", xAxis);
|
||||
BLINKER_LOG("Joystick1 Y axis: ", yAxis);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
JOY1.attach(joystick1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Blinker.notify("!Button Pressed!");
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Blinker.notify("!Button Pressed!");
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define Number_1 "NUMKey"
|
||||
|
||||
BlinkerNumber Number1(Number_1);
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Number1.icon("icon_1");
|
||||
Number1.color("#FFFFFF");
|
||||
Number1.unit("ms");
|
||||
Number1.print(BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define Number_1 "NUMKey"
|
||||
|
||||
BlinkerNumber Number1(Number_1);
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Number1.icon("icon_1");
|
||||
Number1.color("#FFFFFF");
|
||||
Number1.unit("ms");
|
||||
Number1.print(BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.vibrate();
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
Blinker.push("Hello blinker!");
|
||||
|
||||
Blinker.delay(60000);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define RGB_1 "RGBKey"
|
||||
|
||||
BlinkerRGB RGB1(RGB_1);
|
||||
|
||||
void rgb1_callback(uint8_t r_value, uint8_t g_value, uint8_t b_value, uint8_t bright_value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("R value: ", r_value);
|
||||
BLINKER_LOG("G value: ", g_value);
|
||||
BLINKER_LOG("B value: ", b_value);
|
||||
BLINKER_LOG("Rrightness value: ", bright_value);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
RGB1.brightness(random(0, 255));
|
||||
RGB1.print(random(0, 255), random(0, 255), random(0, 255));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
RGB1.attach(rgb1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define RGB_1 "RGBKey"
|
||||
|
||||
BlinkerRGB RGB1(RGB_1);
|
||||
|
||||
void rgb1_callback(uint8_t r_value, uint8_t g_value, uint8_t b_value, uint8_t bright_value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("R value: ", r_value);
|
||||
BLINKER_LOG("G value: ", g_value);
|
||||
BLINKER_LOG("B value: ", b_value);
|
||||
BLINKER_LOG("Rrightness value: ", bright_value);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
RGB1.brightness(random(0, 255));
|
||||
RGB1.print(random(0, 255), random(0, 255), random(0, 255));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
RGB1.attach(rgb1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.vibrate();
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
Blinker.sms("Hello blinker!");
|
||||
|
||||
Blinker.delay(60000);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define Slider_1 "SliderKey"
|
||||
|
||||
BlinkerSlider Slider1(Slider_1);
|
||||
|
||||
void slider1_callback(int32_t value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("get slider value: ", value);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Slider1.color("#FFFFFF");
|
||||
Slider1.print(random(0, 128));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
Slider1.attach(slider1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define Slider_1 "SliderKey"
|
||||
|
||||
BlinkerSlider Slider1(Slider_1);
|
||||
|
||||
void slider1_callback(int32_t value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("get slider value: ", value);
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Slider1.color("#FFFFFF");
|
||||
Slider1.print(random(0, 128));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
Slider1.attach(slider1_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
bool switch_state = false;
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
switch_state = true;
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else if (state == BLINKER_CMD_OFF) {
|
||||
switch_state = false;
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
}
|
||||
|
||||
void heartbeat()
|
||||
{
|
||||
if (switch_state) BUILTIN_SWITCH.print("on");
|
||||
else BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
|
||||
String summary()
|
||||
{
|
||||
String data = "online, switch: " + STRING_format(switch_state ? "on" : "off");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
Blinker.attachHeartbeat(heartbeat);
|
||||
Blinker.attachSummary(summary);
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void switch_callback(const String & state)
|
||||
{
|
||||
BLINKER_LOG("get switch state: ", state);
|
||||
|
||||
if (state == BLINKER_CMD_ON) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
BUILTIN_SWITCH.print("on");
|
||||
}
|
||||
else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
BUILTIN_SWITCH.print("off");
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
|
||||
BUILTIN_SWITCH.attach(switch_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
#define TEXTE_1 "TextKey"
|
||||
|
||||
BlinkerText Text1(TEXTE_1);
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Text1.print("os time", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define TEXTE_1 "TextKey"
|
||||
|
||||
BlinkerText Text1(TEXTE_1);
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
Text1.print("os time", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
#define Tab_1 "TabKey"
|
||||
|
||||
BlinkerTab Tab1(Tab_1);
|
||||
|
||||
bool tab[5] = { false };
|
||||
|
||||
void tab1_callback(uint8_t tab_set)
|
||||
{
|
||||
BLINKER_LOG("get tab set: ", tab_set);
|
||||
|
||||
switch (tab_set)
|
||||
{
|
||||
case BLINKER_CMD_TAB_0 :
|
||||
tab[0] = true;
|
||||
BLINKER_LOG("tab 0 set");
|
||||
break;
|
||||
case BLINKER_CMD_TAB_1 :
|
||||
tab[1] = true;
|
||||
BLINKER_LOG("tab 1 set");
|
||||
break;
|
||||
case BLINKER_CMD_TAB_2 :
|
||||
tab[2] = true;
|
||||
BLINKER_LOG("tab 2 set");
|
||||
break;
|
||||
case BLINKER_CMD_TAB_3 :
|
||||
tab[3] = true;
|
||||
BLINKER_LOG("tab 3 set");
|
||||
break;
|
||||
case BLINKER_CMD_TAB_4 :
|
||||
tab[4] = true;
|
||||
BLINKER_LOG("tab 4 set");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void tab1_feedback()
|
||||
{
|
||||
for(uint8_t num = 0; num < 5; num++)
|
||||
{
|
||||
if (tab[num])
|
||||
{
|
||||
Tab1.tab(num);
|
||||
tab[num] = false;
|
||||
}
|
||||
}
|
||||
Tab1.print();
|
||||
}
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
Tab1.attach(tab1_callback, tab1_feedback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
Blinker.vibrate();
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
|
||||
BLINKER_LOG("Now second: ", Blinker.second());
|
||||
BLINKER_LOG("Now minute: ", Blinker.minute());
|
||||
BLINKER_LOG("Now hour: ", Blinker.hour());
|
||||
BLINKER_LOG("Now wday: ", Blinker.wday());
|
||||
BLINKER_LOG("Now month: ", Blinker.month());
|
||||
BLINKER_LOG("Now mday: ", Blinker.mday());
|
||||
BLINKER_LOG("Now year: ", Blinker.year());
|
||||
BLINKER_LOG("Now yday: ", Blinker.yday());
|
||||
BLINKER_LOG("Now ntp time: ", Blinker.time());
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
|
||||
Blinker.setTimezone(8.0);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
void dataRead(const String & data)
|
||||
{
|
||||
BLINKER_LOG("Blinker readString: ", data);
|
||||
|
||||
uint32_t BlinkerTime = millis();
|
||||
|
||||
Blinker.vibrate();
|
||||
Blinker.print("millis", BlinkerTime);
|
||||
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
Blinker.wechat("Hello blinker!","state","message");
|
||||
|
||||
Blinker.delay(60000);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
Blinker.attachData(dataRead);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_BLE
|
||||
|
||||
#include <Blinker.h>
|
||||
|
||||
// Download Adafruit_NeoPixel library here:
|
||||
// https://github.com/adafruit/Adafruit_NeoPixel
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#ifdef __AVR__
|
||||
#include <avr/power.h>
|
||||
#endif
|
||||
|
||||
#define PIN 13
|
||||
#define NUMPIXELS 9
|
||||
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
#define RGB_1 "RGBKey"
|
||||
|
||||
BlinkerRGB WS2812(RGB_1);
|
||||
|
||||
void ws2812_callback(uint8_t r_value, uint8_t g_value, uint8_t b_value, uint8_t bright_value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("R value: ", r_value);
|
||||
BLINKER_LOG("G value: ", g_value);
|
||||
BLINKER_LOG("B value: ", b_value);
|
||||
BLINKER_LOG("Rrightness value: ", bright_value);
|
||||
|
||||
pixels.setBrightness(bright_value);
|
||||
|
||||
for(int i = 0; i < NUMPIXELS; i++){
|
||||
pixels.setPixelColor(i, r_value, g_value, b_value);
|
||||
}
|
||||
pixels.show();
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin();
|
||||
|
||||
pixels.begin();
|
||||
|
||||
WS2812.attach(ws2812_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* *****************************************************************
|
||||
*
|
||||
* Download latest Blinker library here:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
*
|
||||
* Blinker is a cross-hardware, cross-platform solution for the IoT.
|
||||
* It provides APP, device and server support,
|
||||
* and uses public cloud services for data transmission and storage.
|
||||
* It can be used in smart home, data monitoring and other fields
|
||||
* to help users build Internet of Things projects better and faster.
|
||||
*
|
||||
* Make sure installed 2.7.4 or later ESP8266/Arduino package,
|
||||
* if use ESP8266 with Blinker.
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* Make sure installed 1.0.5 or later ESP32/Arduino package,
|
||||
* if use ESP32 with Blinker.
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* Docs: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************
|
||||
*
|
||||
* Blinker 库下载地址:
|
||||
* https://github.com/blinker-iot/blinker-library/archive/master.zip
|
||||
*
|
||||
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
|
||||
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
|
||||
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
|
||||
*
|
||||
* 如果使用 ESP8266 接入 Blinker,
|
||||
* 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。
|
||||
* https://github.com/esp8266/Arduino/releases
|
||||
*
|
||||
* 如果使用 ESP32 接入 Blinker,
|
||||
* 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。
|
||||
* https://github.com/espressif/arduino-esp32/releases
|
||||
*
|
||||
* 文档: https://diandeng.tech/doc
|
||||
*
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
#define BLINKER_WIFI
|
||||
|
||||
#include <Blinker.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";
|
||||
|
||||
// Download Adafruit_NeoPixel library here:
|
||||
// https://github.com/adafruit/Adafruit_NeoPixel
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#ifdef __AVR__
|
||||
#include <avr/power.h>
|
||||
#endif
|
||||
|
||||
#define PIN 13
|
||||
#define NUMPIXELS 9
|
||||
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
#define RGB_1 "RGBKey"
|
||||
|
||||
BlinkerRGB WS2812(RGB_1);
|
||||
|
||||
void ws2812_callback(uint8_t r_value, uint8_t g_value, uint8_t b_value, uint8_t bright_value)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
BLINKER_LOG("R value: ", r_value);
|
||||
BLINKER_LOG("G value: ", g_value);
|
||||
BLINKER_LOG("B value: ", b_value);
|
||||
BLINKER_LOG("Rrightness value: ", bright_value);
|
||||
|
||||
pixels.setBrightness(bright_value);
|
||||
|
||||
for(int i = 0; i < NUMPIXELS; i++){
|
||||
pixels.setPixelColor(i, r_value, g_value, b_value);
|
||||
}
|
||||
pixels.show();
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
BLINKER_DEBUG.stream(Serial);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
Blinker.begin(auth, ssid, pswd);
|
||||
|
||||
pixels.begin();
|
||||
|
||||
WS2812.attach(ws2812_callback);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Blinker.run();
|
||||
}
|
||||
Reference in New Issue
Block a user