Created
June 27, 2013 11:42
-
-
Save Uepsilon/5875827 to your computer and use it in GitHub Desktop.
Blinking LEDs on IO-Pins
This file contains hidden or 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 time | |
import RPi.GPIO as GPIO | |
try: | |
# Set Mode to BCM | |
GPIO.setmode(GPIO.BOARD) | |
# Define output LEDs | |
GPIO.setup(11, GPIO.OUT, initial=GPIO.LOW) | |
GPIO.setup(13, GPIO.OUT, initial=GPIO.LOW) | |
GPIO.setup(15, GPIO.OUT, initial=GPIO.LOW) | |
GPIO.setup(16, GPIO.OUT, initial=GPIO.LOW) | |
while True: | |
# Activate all LEDs | |
GPIO.output(11, GPIO.HIGH) | |
GPIO.output(13, GPIO.HIGH) | |
GPIO.output(15, GPIO.HIGH) | |
GPIO.output(16, GPIO.HIGH) | |
print "An" | |
# Wait | |
time.sleep(0.5) | |
# Deactivate all LEDs | |
GPIO.output(11, GPIO.LOW) | |
GPIO.output(13, GPIO.LOW) | |
GPIO.output(15, GPIO.LOW) | |
GPIO.output(16, GPIO.LOW) | |
print "Aus" | |
# Wait | |
time.sleep(0.5) | |
finally: | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment