Created
March 19, 2016 17:20
-
-
Save dbrant/48a96018222b51ad2899 to your computer and use it in GitHub Desktop.
GPIO sample for Raspberry Pi
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
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