Skip to content

Instantly share code, notes, and snippets.

@wzr1337
Created November 10, 2017 14:40
Show Gist options
  • Save wzr1337/d877bf98560b2f389b3d22f3f7121eb3 to your computer and use it in GitHub Desktop.
Save wzr1337/d877bf98560b2f389b3d22f3f7121eb3 to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
print GPIO.VERSION
#set up GPIO using BOARD numbering
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
try:
while True:
# light 12
GPIO.output(12, GPIO.HIGH)
time.sleep(0.2)
# off 12
GPIO.output(12, GPIO.LOW)
# light 16
GPIO.output(16, GPIO.HIGH)
time.sleep(0.2)
# off 16
GPIO.output(16, GPIO.LOW)
# light 18
GPIO.output(18, GPIO.HIGH)
time.sleep(0.2)
# off 18
GPIO.output(18, GPIO.LOW)
except KeyboardInterrupt:
pass
# cleanup
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment