The following project is for a nightlight for my grandaughter. There are two buttons; one switches the the LED ring on or off and the other cycles through the FastDemo lighting sequences.
The circuit works (problems with it were discussed on another thread). I took the base code from an Random Nerds Tutorial.
The challenge that I now have is correctly coding the %BUTTONPLACEHOLDER%.
I am not sure how to change the HTML so that the "Pattern" button
- Displays as a button
- The button has a label equal to the pattern sequence number i.e. gCurrentPatternNumber
- If the pattern HTML button is clicked on then the info is fed back to the controller as if the physical cycle button has been pressed.
The main part of this code is here but I am guessing that I will also need to change the CSS.
if(var == "BUTTONPLACEHOLDER"){
String buttons ="";
String outputStateValue = outputState();
buttons+= "<h4>Patten <span id=\"outputState\"><span></h4><label class=\"button\"><input type=\"button\" id=\"output\" " + outputStateValue + "><span class=\"button\"></span></label>"; //Need to display gCurrentPatternNumber somehow
RainbowLights.ino (9.3 KB)