Skip to content

Instantly share code, notes, and snippets.

@dbrant
Created March 19, 2016 17:20
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 dbrant/48a96018222b51ad2899 to your computer and use it in GitHub Desktop.
Save dbrant/48a96018222b51ad2899 to your computer and use it in GitHub Desktop.
GPIO sample for Raspberry Pi
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(4,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(25,GPIO.OUT)
index = 0
while True:
time.sleep(0.1)
GPIO.output(4,GPIO.LOW)
GPIO.output(23,GPIO.LOW)
GPIO.output(25,GPIO.LOW)
index = index + 1
if index % 3 == 0:
GPIO.output(4,GPIO.HIGH)
elif index % 3 == 1:
GPIO.output(23,GPIO.HIGH)
else:
GPIO.output(25,GPIO.HIGH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment