diff --git a/README.md b/README.md index 9f32a2d..69bbc45 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,13 @@ Download [ArduinoProps.zip](https://github.com/fauresystems/ArduinoProps/raw/mas ![](install-shot.png) +Download library dependencies for Library Manager: +* ***PubSubClient*** +* ***ListLib*** + +![](dependencies-shot.png) + + Add `#include "ArduinoProps.h"` on top of your sketch and start coding. Reading [EXAMPLES.md](EXAMPLES.md) will be helpful. |ArduinoProps library documentation | diff --git a/dependencies-shot.png b/dependencies-shot.png new file mode 100644 index 0000000..2364afd Binary files /dev/null and b/dependencies-shot.png differ diff --git a/examples/BlinkOnWifiProps/BlinkOnWifiProps.ino b/examples/BlinkOnWifiProps/BlinkOnWifiProps.ino index 41c5d20..f99424d 100644 --- a/examples/BlinkOnWifiProps/BlinkOnWifiProps.ino +++ b/examples/BlinkOnWifiProps/BlinkOnWifiProps.ino @@ -13,8 +13,8 @@ #include "ArduinoProps.h" // Setup your WiFi network -const char* ssid = ""; -const char *passphrase = ""; +const char* ssid = "Livebox-54A0"; +const char *passphrase = "2ZwEbxpW5L7jthuw3P"; // Builtin led is not available with the shield #undef LED_BUILTIN @@ -36,6 +36,8 @@ PropsDataLogical led(u8"led"); void clignote(); // forward PropsAction clignoteAction = PropsAction(1000, clignote); +bool wifiBegun(false); + void setup() { // can do more static IP configuration @@ -43,12 +45,6 @@ void setup() //WiFi.config(IPAddress(), IPAddress()); //WiFi.config(IPAddress()); - WiFi.begin(ssid, passphrase); - - while (WiFi.status() != WL_CONNECTED) { - delay(500); - } - props.addData(&clignoter); props.addData(&led); @@ -61,6 +57,19 @@ void setup() void loop() { + if (!wifiBegun) { + WiFi.begin(ssid, passphrase); + delay(250); // acceptable freeze for this props (otherwise ues PropsAction) + if (WiFi.status() == WL_CONNECTED) { + wifiBegun = true; + } else { + WiFi.end(); + } + } else if (wifiBegun && WiFi.status() != WL_CONNECTED) { + WiFi.end(); + wifiBegun = false; + } + props.loop(); led.setValue(digitalRead(LED_BUILTIN)); // read I/O