CATEGORY: Logic error, insufficient debouncing. REFERENCE: https://en.wikipedia.org/wiki/Logic_error EXPLANATION: The code only handles bouncing upon pressing the button; it doesn't handle bouncing when the button is released. Typically, when a button is pressed it is released well within 200 ms. If, however, the button is pressed longer, there is no protection against rising edges anymore. CONSEQUENCES: If the button is released after the 200 ms debounce interval, sometimes additional (false) key presses are reported. BUGFIX: After a rising edge has been detected, sample every 10 milliseconds. If the button was really pressed, the read values will be 1. Otherwise, the rising edge must be due to bouncing upon a button release: # Handler that handles rising edge events. def button_pressed(): # Sample five times. for i in range(0, 5): time.sleep(0.010) # Does it look like the button has been released? if GPIO.input(GPIO_PORT) == 0: # Probably a bounce from a button release -> ignore! return print "Button pressed!"