Created
May 10, 2021 23:16
-
-
Save EmperorPenguin18/d62e58d2f5e447cf29c2f4042b98da03 to your computer and use it in GitHub Desktop.
Light show with LEDs and RPI
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 | |
from time import sleep | |
GPIO.setwarnings(False) | |
GPIO.setmode(GPIO.BCM) | |
LED1 = 14 | |
LED2 = 18 | |
LED3 = 24 | |
LED4 = 12 | |
LED5 = 16 | |
GPIO.setup(LED1, GPIO.OUT) | |
GPIO.setup(LED2, GPIO.OUT) | |
GPIO.setup(LED3, GPIO.OUT) | |
GPIO.setup(LED4, GPIO.OUT) | |
GPIO.setup(LED5, GPIO.OUT) | |
delay = 0.1 | |
length = 10 | |
for i in range(0, length): | |
GPIO.output(LED1, True) | |
GPIO.output(LED4, False) | |
sleep(delay) | |
GPIO.output(LED2, True) | |
GPIO.output(LED5, False) | |
sleep(delay) | |
GPIO.output(LED3, True) | |
GPIO.output(LED1, False) | |
sleep(delay) | |
GPIO.output(LED4, True) | |
GPIO.output(LED2, False) | |
sleep(delay) | |
GPIO.output(LED5, True) | |
GPIO.output(LED3, False) | |
sleep(delay) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment