I have this testcode to test bouncing inputs, and I can't figure out how to solve this by code. each time I pull my X3 hi I get 1 to four calbacks. seems like disabling interrupts is way too slow. How to solve this by code? Ideas?
Code: Select all
import pyb
pin = pyb.Pin('X3',pyb.Pin.IN,pyb.Pin.PULL_DOWN)
led = pyb.LED(2)
def cbCutDown( line ):
global pin, led, x1
x1.disable()
print('cb')
pyb.delay(100)
if( pin.value() ):
led.toggle()
x1.enable()
x1 = pyb.ExtInt( pin, pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_DOWN, cbCutDown )