buttonPin = 4-- this is ESP-01 pin GPIO02
gpio.mode(buttonPin,gpio.INT,gpio.PULLUP)
functiondebounce(func)local last = 0local delay = 200000returnfunction(...)local now = tmr.now()
if now - last < delay thenreturnend
last = now
return func(...)
endendfunctiononChange()if gpio.read(buttonPin) == 0thenprint("That was easy! ")
dofile("ifttt.lua")
tmr.delay(500000)
endend
gpio.trig(buttonPin,"down", debounce(onChange))