diff --git a/displayword.lua b/displayword.lua index 91e59a9..3142b2c 100644 --- a/displayword.lua +++ b/displayword.lua @@ -57,7 +57,7 @@ function generateLEDs(words, colorForground, colorMin1, colorMin2, colorMin3, co end if (adc ~= nil) then local per = (100*adc.read(0)/1024) - briPercent = ( ((briPercent * 4) + per) / 5) + briPercent = math.floor( ((briPercent * 4) + per) / 5) print("Minutes : " .. tostring(minutes) .. " bright: " .. tostring(briPercent) .. "% current: " .. tostring(per) .. "%") data.colorFg = string.char(string.byte(colorForground,1) * briPercent / 100, string.byte(colorForground,2) * briPercent / 100, string.byte(colorForground,3) * briPercent / 100) data.colorMin1 = string.char(string.byte(colorMin1,1) * briPercent / 100, string.byte(colorMin1,2) * briPercent / 100, string.byte(colorMin1,3) * briPercent / 100)