Skip to content

Instantly share code, notes, and snippets.

@naotaco
Created March 12, 2015 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotaco/33a55bf1ea57b3763c31 to your computer and use it in GitHub Desktop.
Save naotaco/33a55bf1ea57b3763c31 to your computer and use it in GitHub Desktop.
GPIO-test
#!/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