Last active
December 19, 2015 19:09
-
-
Save deleted/6004162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import vidplay | |
import os | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(4, GPIO.IN) | |
GPIO.setup(22, GPIO.IN) | |
GPIO.setwarnings(False) | |
vidplayer = vidplay.Vidplay() | |
#vidplayer.play(2) | |
#time.sleep(2) | |
#vidplayer.stop() | |
state = "Idle" | |
while True: | |
# Read pin states | |
pin4 = bool(GPIO.input(4)) | |
pin22 = bool(GPIO.input(22)) | |
if state == "Idle": | |
if pin4 and pin22: | |
vidplayer.play(2) | |
state = "Active" | |
print("Active") | |
#elif state == "FadeIn": | |
#print("FadeIn") | |
#os.system('omxplayer -o hdmi FadeIn.mp4 &') | |
#state = "Active" | |
elif state == "Active": | |
if (not pin4) and (not pin22): | |
print("Idle") | |
vidplayer.stop() | |
state = "Idle" | |
#elif state == "FadeOut": | |
#print("FadeOut") | |
#os.system('omxplayer -o hdmi FadeOut.mp4 &') | |
#state = "Idle" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment