Created
December 26, 2022 22:07
-
-
Save LindseyB/a245dfed657a2ca7aa98040f43b4783a to your computer and use it in GitHub Desktop.
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
# Imports | |
from machine import Pin | |
import time | |
#Set up our LED names and GPIO pin numbers | |
red = Pin(18, Pin.OUT) | |
amber = Pin(19, Pin.OUT) | |
green = Pin(20, Pin.OUT) | |
counter = 1 # Set the counter to 1 | |
while counter < 11: # While count is less than 11 | |
print(counter) # Print the current counter | |
# Red ON | |
red.value(1) # ON | |
amber.value(0) # OFF | |
green.value(0) # OFF | |
time.sleep(0.5) # Wait half a second | |
# Amber ON | |
red.value(0) # OFF | |
amber.value(1) # ON | |
green.value(0) # OFF | |
time.sleep(0.5) # Wait half a second | |
# Green ON | |
red.value(0) # OFF | |
amber.value(0) # OFF | |
green.value(1) # ON | |
time.sleep(0.5) # Wait half a second | |
counter += 1 # Add 1 to our counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment