When I was making the Topsy Turvy Clock I created a non blocking delay class so that the Arduino could be doing other things whilst waiting for a timeout. This avoids the use of the delay function which otherwise "blocks" the operation until the timeout is completed. I realised that this same technique could be used to control the flashing of the RGB LED. This will need to be expanded to handle the colour cycling which will indicate that the Wifi settings need configuring.
Code: https://github.com/Workshopshed/EnchantedObjects/tree/master/Code/Examples/Blinker
Example Usage
Here's an example of the blinking code using the LED on pin 13.
#include "Blink.h" Blinker b(1,0); void setup() { b.Blink(Short_Blink); pinMode(13, OUTPUT); } void loop() { digitalWrite(13, b.Level()); //Do other things here as desired }
Virtual Prototyping
As an experiment the code was uploaded to 123D circuits.
https://123d.circuits.io/circuits/868830-blinker-class
This allowed the example to be tested from a web page without the need for actually having an Arduino plugged into the computer.
Next: Swapping out the bridge
Top Comments