In this reader, we will show you Raspberry Pi Pico W Led Blink Using MicroPython Script. We will go over the required hardware, the MicroPython code, and how to upload it to your Pico.
MicroPython is a lean and efficient implementation of the Python 3 programming language that has a small subset of the Python standard library and is optimised to run on microcontrollers. Raspberry Pi Pico W is a new microcontroller board from Raspberry Pi. It’s small, inexpensive, and gives you the ability to control Sensors with code.
Required Material
What is Raspberry Pi Pico W
Raspberry Pi Pico W is a microcontroller board based on the RP2040 chip designed by the Raspberry Pi Foundation. Raspberry Pi Pico W adds on-board single-band 2.4GHz wireless interfaces (802.11n) using the Infineon CYW43439. Pico W comes with a fully certified module on board featuring 2.4GHz 802.11n wireless LAN
The board is provided with two 20-pin dual in-line headers ( GPIO ) which support a total of 40 GPIO pins, as well as four mounting holes. The board has a USB Type-C port for power and programming, a reset button, and a boot mode chooser button. The Raspberry Pi Pico W also has an onboard LED which can be controlled using GPIO pin 25.
How to Program Raspberry pi pico w
First, we need to connect the Raspberry Pi Pico to our PC using a C-type USB cable. Then we need to open the Thonny IDE and create a new file. We will name our file “ blink.py ”. if you use the first time your Raspberry pi pico then see this guide – How To Program Raspberry Pi Pico With Thonny IDE Step by Step
Blink LED
According to Raspberry Pi official documentation, The onboard LED on Raspberry Pi Pico W is connected to GPIO pin 25.
1 2 3 4 |
from machine import Pin led = Pin(25, Pin.OUT) led.value(1) //led on led.value(0) //led off |
Raspberry Pi Pico W onboard LED not working
I tried uploading the above code many times but pico W did not Blink the light. The most possible cause of the onboard LED not working is a hardware issue.
Unlike the earliest Raspberry Pi Pico, the onboard LED on Raspberry Pi Pico W is not connected to a pin on RP2040, a GPIO pin on the wireless chip. MicroPython has been modified accordingly. This means that you can now do:
Raspberry Pi Pico W Led Blink Micropython Script
1 2 3 4 5 6 7 8 9 10 11 |
#diyprojectslab.com import machine import utime led = machine.Pin('LED', machine.Pin.OUT) while True: led.value(1) utime.sleep(1) led.value(0) utime.sleep(0.4) |
Working
Check More interesting Raspberry Pi Pico Projects