Skip to content

Instantly share code, notes, and snippets.

@Uepsilon
Created June 27, 2013 11:42
Show Gist options
  • Save Uepsilon/5875827 to your computer and use it in GitHub Desktop.
Save Uepsilon/5875827 to your computer and use it in GitHub Desktop.
Blinking LEDs on IO-Pins
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