Skip to content

Instantly share code, notes, and snippets.

@pmachapman
Created November 3, 2016 03:06
Show Gist options
  • Save pmachapman/afd21957d17e2ce5c3c80215e14ce98a to your computer and use it in GitHub Desktop.
Save pmachapman/afd21957d17e2ce5c3c80215e14ce98a to your computer and use it in GitHub Desktop.
Raspberry Pi Video Kiosk Program
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