# Project#2 - Blinking both LEDs forever using a while loop. This is building off of project#1 # Connections: Add jumpers to the LED headers (Labelled G16BLU and G17RED) to the left of the coin battery import machine # Think of "import" as importing a library. This library allows for us to use GPIOs import utime # This "library" allows for us to tell time if connected to the internet, and use delays like 'utime.sleep(1)' LEDRED = machine.Pin(16, machine.Pin.OUT) # Set up GPIO16 as an output, and name it LEDRED LEDBLU = machine.Pin(17, machine.Pin.OUT) # Do the same for GPIO17 LEDRED.value(0) # Turn the red LED off. If you set it to (1), then you'd be turning it on LEDBLU.value(0) # Turn the blue LED off. If you set it to (1), then you'd be turning it on while True: # Loop forever. We've exchanged our FOR/range with a While loop. Because the condition is set, the following code will loop forever. LEDRED.value(1) # Turn the red LED on. Notice the indent here. This naturally happens after a colon. It is necessary to compile utime.sleep(0.01) # Wait 10ms (0.01 seconds) LEDRED.value(0) # Turn the red LED off utime.sleep(0.01) # Wait another 0.01 seconds LEDBLU.value(1) # Do the same for the Blue LED utime.sleep(0.01) LEDBLU.value(0) utime.sleep(0.01) # To stop this code from executing, press the "STOP" button above. To replay, press the "PLAY" button. # It is always a good idea to save your programs both on your Pico and on your computer as a backup. I've had code corrupted before # So keep in mind that you can always save it to two different locations.