Skip to content

Instantly share code, notes, and snippets.

@LindseyB
Created December 26, 2022 22:07
Show Gist options
  • Select an option

  • Save LindseyB/a245dfed657a2ca7aa98040f43b4783a to your computer and use it in GitHub Desktop.

Select an option

Save LindseyB/a245dfed657a2ca7aa98040f43b4783a to your computer and use it in GitHub Desktop.

Revisions

  1. Lindsey Bieda created this gist Dec 26, 2022.
    37 changes: 37 additions & 0 deletions blink_row.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    # 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