Blinking the Onboard LED

by caoow31 in Circuits > Raspberry Pi

168 Views, 0 Favorites, 0 Comments

Blinking the Onboard LED

uegshd.gif

Learn how to blink the onboard LED of the Raspberry Pi Pico!

Supplies

Photo on BE 2566-7-26 at 8.57 AM #3.jpg

A Raspberry Pi Pico! That's all you need!

Understanding

Screen Shot 2566-08-03 at 3.24.33 PM.png

The GPIO Pin of the LED we are programing is 25, located next to the BOOTSEL button on the Raspberry Pi Pico.

Coding

Screen Shot 2566-08-03 at 3.26.17 PM.png

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!