# The number sign is for comments. Think of "//" for Arduino # This is the first project for the Pico Pal. We'll be building on this project to include all electronic blocks # Project#1 - Blinking both LEDs # 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 for i in range(100): # This is range. Think of it as a simple FOR loop. Loop the following 100x times. Notice the colon! 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) # Once the above code is done executing, the program ends. It doesn't loop. # Don't forget to save this. If you save this program to your Pico, you can name it blink.py or "main.py". # If you name it as "main.py", then the Pico will ecxecute this specific code on power up. # The Pico can save many pieces of code internally. It will always run main.py on power uf (If it exists).