Skip to content

Instantly share code, notes, and snippets.

Created June 16, 2016 17:34
Show Gist options
  • Save anonymous/4fc8ea42582c2bd7e30a6424093929d1 to your computer and use it in GitHub Desktop.
Save anonymous/4fc8ea42582c2bd7e30a6424093929d1 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jun 16, 2016.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    import RPi.GPIO as GPIO
    import time
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(11, GPIO.IN)
    GPIO.setup(3, GPIO.OUT)
    while True:
    i=GPIO.input(11)
    if i==0:
    print "Screen Off",i
    tvservice -o
    GPIO.output(3, 0)
    time.sleep(0.1)
    elif i==1:
    print "Screen On",i
    tvservice -p
    chvt 6
    chvt 7
    GPIO.output(3, 1)
    time.sleep(60)