From 2c343241a6f73179bc1ff869141b2d50875e77f8 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Thu, 29 Nov 2018 22:17:32 +0000 Subject: [PATCH] Make sure that we don't output value less than 0. This was causing lights to stay on. --- Lighting.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lighting.cpp b/Lighting.cpp index 4c9471c..6aefd2c 100644 --- a/Lighting.cpp +++ b/Lighting.cpp @@ -61,6 +61,8 @@ void Lighting::updateRGB(int now) { void Lighting::updateWhite(){ float brightness = (_heatIndex - 0.5) / 0.5; + if (brightness<0) + brightness = 0; analogWrite(_whitePin, 1024 * brightness); }