Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Extension for SPEED slider
- //changed FUNCTIONxxxON into F_xxx to save space in the char buffer
- //in definitions:
- int SPEED = 120;
- int new_SPEED = 120;
- ///////////////////////////////////////////////////////////////////////////////
- // output parameters to serial, you may connect e.g. an Arduino and react on it
- ///////////////////////////////////////////////////////////////////////////////
- if(sParam.length()>0)
- { // output parameters
- int iEqu=sParam.indexOf("=");
- if(iEqu>=0)
- { // is there a message?
- sCmd = sParam.substring(iEqu+1,sParam.length());
- // Serial.print("We are in output Parameters, value is: ");
- int iEqu_bright=sParam.indexOf("200");
- if (iEqu_bright>=0)
- {
- sCmd = sParam.substring(iEqu+1,sParam.length()); // BRIGHTNESS
- Serial.println(sCmd);
- char carray[4]; // values 0..255 = 3 digits; array = digits + 1
- sCmd.toCharArray(carray, sizeof(carray)); // convert char to the array
- new_BRIGHTNESS = atoi(carray); // atoi() converts an ascii character array to an integer
- if (new_BRIGHTNESS == 0) {new_BRIGHTNESS = BRIGHTNESS; }
- BRIGHTNESS = new_BRIGHTNESS;
- FastLED.setBrightness(new_BRIGHTNESS);
- Serial.print("new Brightness: ");
- Serial.println(new_BRIGHTNESS);
- }
- // space for RGB (300, 400, 500)
- int iEqu_speed=sParam.indexOf("600=");
- if (iEqu_speed>=0)
- {
- sCmd = sParam.substring(iEqu+1,sParam.length()); // speed
- // Serial.print("We are in SPEED, value is: ");
- Serial.println(sCmd);
- char carray[4]; // values 0..255 = 3 digits; array = digits + 1
- sCmd.toCharArray(carray, sizeof(carray)); // convert char to the array
- new_SPEED = atoi(carray); // atoi() converts an ascii character array to an integer
- if (new_SPEED == 0) {new_SPEED = SPEED; } // if something else is selected (no change in brightness)
- SPEED = new_SPEED;
- FRAMES_PER_SECOND = SPEED;
- // FastLED.setMaxRefreshRate(new_SPEED); // thought this would work :(
- Serial.print("new FPS: ");
- Serial.println(SPEED);
- // Serial.print("refresh: ");
- // Serial.println(1000/new_SPEED);
- }
- } // end is there a message?
- } // end output Parameters
- ///////////////////////////
- // format the html response
- ///////////////////////////
- // under brightness slider:
- sResponse += "</p>";
- sResponse += "<form action=\"?sCmd\" >"; // ?sCmd forced the '?' at the right spot
- sResponse += "<input type=\"submit\" value=\"SET\">";
- sResponse += "   <font color=yellow><b>SPEED "; // perhaps we can show here the current value
- sResponse += round(new_SPEED /2); // this is just a scale depending on the max value; round for better readability
- sResponse += " %";
- sResponse += "<BR>";
- sResponse += "<input style=\"width:250px; height:50px\" type=\"range\" name=\"=F_600\" id=\"cmd\" value=\""; // '=' in front of F__200 forced the = at the right spot
- sResponse += SPEED;
- sResponse += "\" min=20 max=400 step=20 onchange=\"showValue(points)\" />";
- sResponse += "</font></b>";
- sResponse += "</form>";
- sResponse += "<p>";
- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- if(sCmd.indexOf("F_200=250")>=0) { }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //under F200_values
- if(sCmd.indexOf("F_600=20")>=0) { }
- if(sCmd.indexOf("F_600=40")>=0) { }
- if(sCmd.indexOf("F_600=60")>=0) { }
- if(sCmd.indexOf("F_600=80")>=0) { }
- if(sCmd.indexOf("F_600=100")>=0) { }
- if(sCmd.indexOf("F_600=120")>=0) { }
- if(sCmd.indexOf("F_600=140")>=0) { }
- if(sCmd.indexOf("F_600=160")>=0) { }
- if(sCmd.indexOf("F_600=180")>=0) { }
- if(sCmd.indexOf("F_600=200")>=0) { }
- if(sCmd.indexOf("F_600=220")>=0) { }
- if(sCmd.indexOf("F_600=240")>=0) { }
- if(sCmd.indexOf("F_600=260")>=0) { }
- if(sCmd.indexOf("F_600=280")>=0) { }
- if(sCmd.indexOf("F_600=300")>=0) { }
- if(sCmd.indexOf("F_600=320")>=0) { }
- if(sCmd.indexOf("F_600=340")>=0) { }
- if(sCmd.indexOf("F_600=360")>=0) { }
- if(sCmd.indexOf("F_600=380")>=0) { }
- if(sCmd.indexOf("F_600=400")>=0) { }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement