Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- from time import sleep
- import os
- from subprocess import check_output
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- status = 0
- while True:
- input_state = GPIO.input(21)
- if input_state == False:
- if status == 0:
- print('AV')
- status = 1
- #Switch to AV
- os.system("sudo killall emulationstation; tvservice -c \"PAL 4:3\"; fbset -depth 8; fbset -depth 16; emulationstation")
- else:
- print('HDMI')
- status = 0
- #Switch to HDMI
- os.system("sudo killall emulationstation; tvservice -p; fbset -depth 8; fbset -depth 16; emulationstation")
- time.sleep(0.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement