Hi,
When you hit ctrl-z during the execution of a rpi.gpio program with interrupts, then hit bg (background), it will start running in the back ground, but interrupts stop.
Example:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8,GPIO.IN)
GPIO.setup(10,GPIO.OUT)
def my_callback(channel):
GPIO.output(10,1)
time.sleep(2)
GPIO.output(10,0)
print "Rising edge detected on port 8 - even though, in the main thread,"
print "we are still waiting for a falling edge - how cool?\n"
GPIO.add_event_detect(8, GPIO.RISING, callback=my_callback)
try:
print "Waiting for rising edge on port 8"
while 1:
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
GPIO.cleanup()
When you put this program in the background with ctrl-z, bg it fails.
Running this program from the start in the background (using &) it works ok.