Last active
May 19, 2016 15:10
-
-
Save d2rk/e547891c1e587236b68247bc0b611eda to your computer and use it in GitHub Desktop.
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 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