I have the following code
--button.lua
pinA = 2
pinB = 3
gpio.mode(pinA, gpio.INT, gpio.PULLUP)
gpio.mode(pinB, gpio.INT, gpio.PULLUP)
function debounce (func)
local last = 0
local delay = 100000
return function (...)
local now = tmr.now()
if now - last < delay then return end
last = now
return func(...)
end
end
function onChangeA ()
print('The pinA value has changed to '..gpio.read(pinA))
--dofile("ifttt_A.lua")
end
function onChangeB ()
print('The pinB value has changed to '..gpio.read(pinB))
--dofile("ifttt_B.lua")
end
gpio.mode(pinA, gpio.INT)
gpio.trig(pinA, 'down', debounce(onChangeA))
gpio.mode(pinB, gpio.INT)
gpio.trig(pinB, 'down', debounce(onChangeB))I would expect it to trig the external interrupt only on a low transition, but it triggers on a high transition. What am I doing wrong here? The internal pullup doesn't seem to work either so I use a external 10 k pullup.