I have a python script running as a service on Raspbian Jessie that watches for a button being pressed and lights an LED when it is done. Initially everything works as designed, however I have found that once the process has been running for several hours at seemingly random intervals the GPIO pin that is attached to the button is pulled down and acts if the button is pressed. What is unexpected is that when I press the button it then acts like it is not pressed (this wasn't expected as I assumed there was a short). The button is wired to ground and I have a 10K pull-up resistor in place on both the LED and the button.
Script is wired like this (LED to 25, button to 24):
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(25, GPIO.OUT) GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP) def button(channel): if GPIO.input(24): GPIO.output(25,False) print "rising edge detected on port 24" else: GPIO.output(25,True) print "falling edge detected on port 24" GPIO.add_event_detect(24, GPIO.BOTH, callback=button, bouncetime=300) while 1: sleep(30) GPIO.cleanup()