I've got a photo booth program I'm working on that takes the photo of the user and displays it on the screen for 5-10 seconds. At the end of that 5-10 seconds, I'd like the booth to reset unless a particular GPIO button has been pressed.
I was able to find an analogous code snippet to what I'd like to do, but I can't seem to make it take GPIO.input() or GPIO event detection into account. Trying GPIO.wait_for_event, just causes the process to hang while it waits for input. It's important that the default operation is to just reset the photobooth for the next person (without intervention).
#!/usr/bin/env python import time from threading import Thread answer = None def check(): time.sleep(5) if answer == 'y': print "\nSounds good, I'll send it to the queue!" time.sleep(1) print "\nMoving on..." Thread(target=check).start() answer = raw_input("You have 5 seconds. Print? [y/n]: ")