Last active
October 6, 2016 02:58
-
-
Save rxseger/7ea4c3c5d3d4811e69ad7cf3b524bb6d to your computer and use it in GitHub Desktop.
toggle ac power outlet GPIO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import RPi.GPIO as GPIO | |
if len(sys.argv) < 2: | |
print 'usage: %s [0/1]' % (sys.argv[0],) | |
raise SystemExit | |
GPIO.setmode(GPIO.BOARD) | |
CONTROL = 16 # G23 | |
GPIO.setwarnings(False) | |
GPIO.setup(CONTROL, GPIO.OUT, initial=GPIO.LOW) | |
on = bool(int(sys.argv[1])) | |
print on | |
GPIO.output(CONTROL, on) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment