Skip to content

Instantly share code, notes, and snippets.

@schappim
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save schappim/11284296 to your computer and use it in GitHub Desktop.

Select an option

Save schappim/11284296 to your computer and use it in GitHub Desktop.
import sys
pin = int(sys.argv[1].rstrip())
print pin
import RPi.GPIO as GPIO ## Import GPIO library
GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(pin, GPIO.OUT) ## Setup GPIO Pin to OUT
state = False
while 1:
command = raw_input("wait for key")
GPIO.output(pin,state) ## Turn on GPIO pin
state = not state
## Red is 11
## Green is 13
## Blue is 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment