-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from blinker-iot/dev_2.0
update codes, upgrade BLINKER WIF & MQTT codes
- Loading branch information
Showing
46 changed files
with
617 additions
and
1,039 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 70 additions & 70 deletions
140
examples/Blinker_AQI/AQI_MQTT/AQI_MQTT.ino → examples/Blinker_AQI/AQI_WiFi/AQI_WiFi.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
/* ***************************************************************** | ||
* | ||
* Download latest Blinker library here: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* | ||
* Blinker is a platform with iOS and Android apps to | ||
* control embedded hardware like Arduino, Raspberrt Pi. | ||
* You can easily build graphic interfaces for all your | ||
* projects by simply dragging and dropping widgets. | ||
* | ||
* Docs: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* ***************************************************************** | ||
* | ||
* Blinker 库下载地址: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* Blinker 是一个运行在 IOS 和 Android 上用于控制嵌入式硬件的应用程序。 | ||
* 你可以通过拖放控制组件,轻松地为你的项目建立图形化控制界面。 | ||
* | ||
* 文档: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* *****************************************************************/ | ||
|
||
#define BLINKER_PRINT Serial | ||
#define BLINKER_MQTT | ||
|
||
#include <Blinker.h> | ||
|
||
char auth[] = "Your MQTT 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)); | ||
String get_aqi = Blinker.aqi(); | ||
BLINKER_LOG("AQI: ", get_aqi); | ||
|
||
Blinker.delay(60000); | ||
} | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
|
||
#if defined(BLINKER_PRINT) | ||
BLINKER_DEBUG.stream(BLINKER_PRINT); | ||
#endif | ||
|
||
pinMode(LED_BUILTIN, OUTPUT); | ||
digitalWrite(LED_BUILTIN, LOW); | ||
|
||
Blinker.begin(auth, ssid, pswd); | ||
Blinker.attachData(dataRead); | ||
} | ||
|
||
void loop() | ||
{ | ||
Blinker.run(); | ||
/* ***************************************************************** | ||
* | ||
* Download latest Blinker library here: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* | ||
* Blinker is a platform with iOS and Android apps to | ||
* control embedded hardware like Arduino, Raspberrt Pi. | ||
* You can easily build graphic interfaces for all your | ||
* projects by simply dragging and dropping widgets. | ||
* | ||
* Docs: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* ***************************************************************** | ||
* | ||
* Blinker 库下载地址: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* Blinker 是一个运行在 IOS 和 Android 上用于控制嵌入式硬件的应用程序。 | ||
* 你可以通过拖放控制组件,轻松地为你的项目建立图形化控制界面。 | ||
* | ||
* 文档: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* *****************************************************************/ | ||
|
||
#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"; | ||
|
||
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)); | ||
String get_aqi = Blinker.aqi(); | ||
BLINKER_LOG("AQI: ", get_aqi); | ||
|
||
Blinker.delay(60000); | ||
} | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
|
||
#if defined(BLINKER_PRINT) | ||
BLINKER_DEBUG.stream(BLINKER_PRINT); | ||
#endif | ||
|
||
pinMode(LED_BUILTIN, OUTPUT); | ||
digitalWrite(LED_BUILTIN, LOW); | ||
|
||
Blinker.begin(auth, ssid, pswd); | ||
Blinker.attachData(dataRead); | ||
} | ||
|
||
void loop() | ||
{ | ||
Blinker.run(); | ||
} |
File renamed without changes.
156 changes: 78 additions & 78 deletions
156
...ples/Blinker_AUTO/AUTO_MQTT/AUTO_MQTT.ino → ...ples/Blinker_AUTO/AUTO_WiFi/AUTO_WiFi.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
/* ***************************************************************** | ||
* | ||
* Download latest Blinker library here: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* | ||
* Blinker is a platform with iOS and Android apps to | ||
* control embedded hardware like Arduino, Raspberrt Pi. | ||
* You can easily build graphic interfaces for all your | ||
* projects by simply dragging and dropping widgets. | ||
* | ||
* Docs: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* ***************************************************************** | ||
* | ||
* Blinker 库下载地址: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* Blinker 是一个运行在 IOS 和 Android 上用于控制嵌入式硬件的应用程序。 | ||
* 你可以通过拖放控制组件,轻松地为你的项目建立图形化控制界面。 | ||
* | ||
* 文档: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* *****************************************************************/ | ||
|
||
/* | ||
* | ||
* This example not complete at all, TODO. | ||
* | ||
* / | ||
// #define BLINKER_PRINT Serial | ||
// #define BLINKER_MQTT | ||
// #include <Blinker.h> | ||
// char auth[] = "Your MQTT Secret Key"; | ||
// char ssid[] = "Your WiFi network SSID or name"; | ||
// char pswd[] = "Your WiFi network WPA password or WEP key"; | ||
// #define BUTTON_1 "ButtonKey" | ||
// void setup() { | ||
// Serial.begin(115200); | ||
// pinMode(LED_BUILTIN, OUTPUT); | ||
// digitalWrite(LED_BUILTIN, LOW); | ||
// Blinker.begin(auth, ssid, pswd); | ||
// Blinker.beginAuto(); | ||
// Blinker.wInit(BUTTON_1, W_BUTTON); | ||
// } | ||
// void loop() | ||
// { | ||
// Blinker.run(); | ||
// if (Blinker.available()) { | ||
// BLINKER_LOG("Blinker readString: ", data); | ||
// uint32_t BlinkerTime = millis(); | ||
// Blinker.beginFormat(); | ||
// Blinker.vibrate(); | ||
// Blinker.print("millis", BlinkerTime); | ||
// Blinker.endFormat(); | ||
// } | ||
// if (Blinker.button(BUTTON_1)) { | ||
// digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); | ||
// } | ||
// Blinker.autoInput("key", "value"); | ||
// Blinker.autoRun(); | ||
// Blinker.delay(1000); | ||
/* ***************************************************************** | ||
* | ||
* Download latest Blinker library here: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* | ||
* Blinker is a platform with iOS and Android apps to | ||
* control embedded hardware like Arduino, Raspberrt Pi. | ||
* You can easily build graphic interfaces for all your | ||
* projects by simply dragging and dropping widgets. | ||
* | ||
* Docs: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* ***************************************************************** | ||
* | ||
* Blinker 库下载地址: | ||
* https://github.com/blinker-iot/blinker-library/archive/master.zip | ||
* | ||
* Blinker 是一个运行在 IOS 和 Android 上用于控制嵌入式硬件的应用程序。 | ||
* 你可以通过拖放控制组件,轻松地为你的项目建立图形化控制界面。 | ||
* | ||
* 文档: https://doc.blinker.app/ | ||
* https://github.com/blinker-iot/blinker-doc/wiki | ||
* | ||
* *****************************************************************/ | ||
|
||
/* | ||
* | ||
* This example not complete at all, TODO. | ||
* | ||
* / | ||
// #define BLINKER_PRINT Serial | ||
// #define BLINKER_MQTT | ||
// #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" | ||
// void setup() { | ||
// Serial.begin(115200); | ||
// pinMode(LED_BUILTIN, OUTPUT); | ||
// digitalWrite(LED_BUILTIN, LOW); | ||
// Blinker.begin(auth, ssid, pswd); | ||
// Blinker.beginAuto(); | ||
// Blinker.wInit(BUTTON_1, W_BUTTON); | ||
// } | ||
// void loop() | ||
// { | ||
// Blinker.run(); | ||
// if (Blinker.available()) { | ||
// BLINKER_LOG("Blinker readString: ", data); | ||
// uint32_t BlinkerTime = millis(); | ||
// Blinker.beginFormat(); | ||
// Blinker.vibrate(); | ||
// Blinker.print("millis", BlinkerTime); | ||
// Blinker.endFormat(); | ||
// } | ||
// if (Blinker.button(BUTTON_1)) { | ||
// digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); | ||
// } | ||
// Blinker.autoInput("key", "value"); | ||
// Blinker.autoRun(); | ||
// Blinker.delay(1000); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.