Increase button reaction loop

This commit is contained in:
Ollo 2022-12-09 21:48:43 +01:00
parent bba21e562b
commit 35a802009b

View File

@ -225,12 +225,12 @@ gpio.mode(3, gpio.INPUT)
local btnCounter=0 local btnCounter=0
-- Start the time Thread handling the button -- Start the time Thread handling the button
local btntimer = tmr.create() local btntimer = tmr.create()
btntimer:register(5000, tmr.ALARM_AUTO, function (t) btntimer:register(500, tmr.ALARM_AUTO, function (t)
if (gpio.read(3) == 0) then if (gpio.read(3) == 0) then
mlt:unregister() mlt:unregister()
print("Button pressed " .. tostring(btnCounter)) print("Button pressed " .. tostring(btnCounter))
btnCounter = btnCounter + 5 btnCounter = btnCounter + 5
for i=1,btnCounter do rgbBuffer:set(i, 128, 0, 0) end for i=1,btnCounter do rgbBuffer:set(i, 0, 128, 0) end
ws2812.write(rgbBuffer) ws2812.write(rgbBuffer)
if (btnCounter >= 110) then if (btnCounter >= 110) then
file.remove("config.lua") file.remove("config.lua")