Created
November 3, 2016 03:06
-
-
Save pmachapman/afd21957d17e2ce5c3c80215e14ce98a to your computer and use it in GitHub Desktop.
Raspberry Pi Video Kiosk Program
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 RPi.GPIO as GPIO | |
import time | |
import os | |
import atexit | |
# Setup exit handler | |
def exit_handler(): | |
# Reset cursor | |
os.system("setterm -cursor on") | |
atexit.register(exit_handler) | |
# Clear screen and hide the cursor | |
os.system("clear") | |
os.system("setterm -cursor off") | |
# Set up GPIO for button | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) | |
# Start video on button input | |
while True: | |
input_state = GPIO.input(18) | |
if input_state == False: | |
os.system("omxplayer -b -o local ~/Videos/test_h264.mp4 > /dev/null 2>&1") | |
time.sleep(0.2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment