Blinking the Onboard LED
Learn how to blink the onboard LED of the Raspberry Pi Pico!
Supplies
A Raspberry Pi Pico! That's all you need!
Understanding
The GPIO Pin of the LED we are programing is 25, located next to the BOOTSEL button on the Raspberry Pi Pico.
Coding
Type in this code into your Thonny window and click run. The LED will blink once.
Understanding the Code
In the first 2 lines of the code, we import the module "machine" and "time". "Machine" is like the Raspberry Pi Pico itself and the "Pin" are the GPIOs on the Pico. "Time" is a module that is used also in Python, CircuitPython, and MicroPython. "Sleep" is telling the Pico to stop it's action to give it resting time as shown in the parentheses next to the "sleep". When we write Pin(25, Pin.OUT), it is finding that specific pin and that will light the LED. ".value(1)" means to send electricity through Pin 25 and ".value(0)" means to stop sending electricity. Thank you for reading and enjoy your blinking onboard LED!