Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- from subprocess import call
- GPIO.setwarnings(False)
- GPIO.setmode(GPIO.BOARD)
- GPIO.setup(11, GPIO.IN)
- while true:
- i = GPIO.input(11)
- if i ==0:
- print("Screen off", i)
- call("vcgencmd display_power 0")
- time.sleep(1)
- elif i ==1:
- print("Screen on", i)
- call("vcgencmd display_power 1")
- time.sleep(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement