Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. from time import sleep
  3. import os
  4. from subprocess import check_output
  5.  
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  8. status = 0
  9.  
  10. while True:
  11. input_state = GPIO.input(21)
  12. if input_state == False:
  13. if status == 0:
  14. print('AV')
  15. status = 1
  16. #Switch to AV
  17. os.system("sudo killall emulationstation; tvservice -c \"PAL 4:3\"; fbset -depth 8; fbset -depth 16; emulationstation")
  18. else:
  19. print('HDMI')
  20. status = 0
  21. #Switch to HDMI
  22. os.system("sudo killall emulationstation; tvservice -p; fbset -depth 8; fbset -depth 16; emulationstation")
  23. time.sleep(0.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement