Skip to content

Instantly share code, notes, and snippets.

@d2rk
Last active May 19, 2016 15:10
Show Gist options
  • Save d2rk/e547891c1e587236b68247bc0b611eda to your computer and use it in GitHub Desktop.
Save d2rk/e547891c1e587236b68247bc0b611eda to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
LED_PINS = (31, 33, 35, 37)
BUTTON_PIN = 29
GPIO.setmode(GPIO.BOARD) # use board pin numbering
for i in LED_PINS:
GPIO.setup(i, GPIO.OUT)
GPIO.setup(BUTTON_PIN, GPIO.IN)
while True:
input_state = GPIO.input(BUTTON_PIN)
if input_state == False:
for i in range(3):
for i in LED_PINS:
GPIO.output(i, True) # turn on GPIO pin
time.sleep(0.1)
for i in LED_PINS:
GPIO.output(i, False) # turn off GPIO pin
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment