I have some sample code (taken out of my larger program) that regularly (but not always) missing the first rising edge:
#!/usr/bin/python import pigpio, time def callback(g, l, t): print("Callback trigger "+ str(g)+ " " +str(l)+ " " +str(t)) pi = pigpio.pi() if not pi.connected: # Check connected print("Not connected to PIGPIO Daemon") else: print("Connected to PIGPIO Daemon") pinStartGate = 20 pi.set_mode(pinStartGate, pigpio.INPUT) pi.set_pull_up_down(pinStartGate, pigpio.PUD_DOWN) pi.set_noise_filter(pinStartGate, 50000, 50000) # Debounce switch # pi.set_glitch_filter(pinStartGate, 50000) # Debounce switch cb1 = pi.callback(pinStartGate, pigpio.FALLING_EDGE, callback) while(True): print("Direct trigger" + str(pi.read(pinStartGate))) time.sleep(1)
running this, with pin 20 initially not connected, and then connecting to 3.3v or 5v gives:
Direct trigger0 Direct trigger0 Direct trigger1 Direct trigger1 Direct trigger0 Direct trigger0 Callback trigger 20 0 2414139526 Direct trigger1 Direct trigger1 Direct trigger0 Direct trigger0 Callback trigger 20 0 2418808728 Direct trigger1 Direct trigger1
You can see that the first trigger, does not trigger the Callback.
I am also suprised by the way around that I need to use 'pigpio.FALLING_EDGE' as in electrical terms it is the Rising edge that I am triggering based upon (going from not connected, so pigpio.PUD_DOWN = 0v to externally connected to 3.3v or 5v?
Running Raspbian Stretch, Python 3.5.3 and pigpio v64
Thanks very much Kevin