Make sure that we don't output value less than 0. This was causing lights to stay on.
This commit is contained in:
parent
11c37b7180
commit
2c343241a6
1 changed files with 2 additions and 0 deletions
|
@ -61,6 +61,8 @@ void Lighting::updateRGB(int now) {
|
||||||
|
|
||||||
void Lighting::updateWhite(){
|
void Lighting::updateWhite(){
|
||||||
float brightness = (_heatIndex - 0.5) / 0.5;
|
float brightness = (_heatIndex - 0.5) / 0.5;
|
||||||
|
if (brightness<0)
|
||||||
|
brightness = 0;
|
||||||
analogWrite(_whitePin, 1024 * brightness);
|
analogWrite(_whitePin, 1024 * brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue