added ADC brightness reading

This commit is contained in:
ollo 2019-03-22 23:52:25 +01:00
parent a37474724a
commit c94e046f6c

View File

@ -85,15 +85,24 @@ function generateLEDs(words, colorForground, colorMin1, colorMin2, colorMin3, co
minutes = minutes + 4 minutes = minutes + 4
end end
data.charsPerMinute = round( (characters / minutes) ) data.charsPerMinute = round( (characters / minutes) )
if (adc ~= nil) then
briPercent=(100*adc.read(0)/900)
print("Minutes : " .. tostring(minutes) .. " Char minutes: " .. tostring(data.charsPerMinute) .. " bright: " .. tostring(briPercent) .. "%")
data.colorFg = colorForground
data.colorMin1 = colorMin1
data.colorMin2 = colorMin2
data.colorMin3 = colorMin3
data.colorMin4 = colorMin4
else
-- devide by five (Minute 0, Minute 1 to Minute 4 takes the last chars) -- devide by five (Minute 0, Minute 1 to Minute 4 takes the last chars)
print("Minutes : " .. tostring(minutes) .. " Char minutes: " .. tostring(data.charsPerMinute) ) print("Minutes : " .. tostring(minutes) .. " Char minutes: " .. tostring(data.charsPerMinute) )
data.words=words
data.colorFg=colorForground data.colorFg=colorForground
data.colorMin1=colorMin1 data.colorMin1=colorMin1
data.colorMin2=colorMin2 data.colorMin2=colorMin2
data.colorMin3=colorMin3 data.colorMin3=colorMin3
data.colorMin4=colorMin4 data.colorMin4=colorMin4
end
data.words=words
data.drawnCharacters=0 data.drawnCharacters=0
data.drawnWords=0 data.drawnWords=0
data.amountWords=display_countwords_de(words) data.amountWords=display_countwords_de(words)