I have a project with five sliders controlling an RGBW strand of LEDs. Four of the sliders control the four color channels; the fifth is a multiplier that I use to control overall brightness.
These LED strands take color channel values from 0:255, but to make things more user (non-techie) friendly, I’ve set up my sliders to run from 0:100 with an increment of 0.5. When my ESP receives this value, it multiplies this as a percentage to get the proper 0:255 value to pass to the LED driver.
What I have found is that none of the sliders will actually send a value of 0 when the slider is all the way to the left. I figured this was either an edge case (where the lower limit, whatever it may be, is never sent) or, more likely, a Boolean error (where the slider must have a non-zero value for the value for the value to be sent.
I ruled out the edge case by setting the lower limit to -0.5 on one slider. With the slider all the way to the left, my ESP does receive a
value of -0.5. However, when I slide it slightly right to zero, that value never gets sent (or received; I can’t tell which )
This is on Chrome browser on a Macbook. ESP Wemos D1 mini as device node.
All of the receiver “functions” (I assume they’re macros) follow this format:
// Channel 11 will be used to set the R value. Passed as a %; stored as
// a 0-255 value
Serial.print("Received on channel 11: ");
Serial.print(" == ");
double dValue = getValue.asDouble();
R = dValue * 255/100.0;
//colorWipe(strip.Color(R*brightness, G*brightness, B*brightness, W*brightness), 0);
colorSet(strip.Color(R*brightness/100.0, G*brightness/100.0, B*brightness/100.0, W*brightness/100.0));