Created
March 12, 2015 15:41
-
-
Save naotaco/33a55bf1ea57b3763c31 to your computer and use it in GitHub Desktop.
GPIO-test
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 RPi.GPIO as GPIO | |
import time | |
import sys | |
import atexit | |
atexit.register(GPIO.cleanup) | |
pin = 35 # as board | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(pin, GPIO.OUT) | |
command = sys.argv[1] | |
if (command == 'on'): | |
GPIO.output(pin, True) | |
print ("Turing on") | |
elif (command == 'off'): | |
GPIO.output(pin, False) | |
print ("Turning off") | |
while 1: | |
time.sleep(100) | |
print("Program exit\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment