Get Started with MicroPython on Raspberry Pi Pico

by Raspberry Pi

Microcontrollers, like RP2040 at the heart of Raspberry Pi Pico, are computers stripped back to their bare essentials.

You don’t use monitors or keyboards, but program them to take their input from, and send their output to the input/output pins. Using these programmable connections, you can light lights, make noises, send text to screens, and much more

In Get Started with MicroPython on Raspberry Pi Pico, you will learn how to use the beginner-friendly language MicroPython to write programs and connect up hardware to make your Raspberry Pi Pico interact with the world around it. Using these skills, you can create your own electro-mechanical projects, whether for fun or to make your life easier.

Errata (for all versions): If you are using the Raspberry Pi Pico W, you will need to change the definition of led_onboard (pages 46, 48, and 52):

led_onboard = machine.Pin(25, machine.Pin.OUT)

…should change to:

led_onboard = machine.Pin("LED", machine.Pin.OUT)

About Raspberry Pi Press

Raspberry Pi Press is the publishing imprint of Raspberry Pi Trading Ltd., a subsidiary of The Raspberry Pi Foundation. Buying Raspberry Pi Press books and magazines directly helps the Foundation’s charitable mission to put the power of computing and digital making in the hands of people all over the world.

About the authors

Gareth Halfacree is a freelance technology journalist, writer, and former system administrator in the education sector. With a passion for open-source software and hardware, he was an early adopter of the Raspberry Pi platform and has written several publications on its capabilities and flexibility.

Ben Everard is a geek who has stumbled into a career that lets him play with new hardware. As the editor of HackSpace magazine, he spends more time than he really should experimenting with the latest (and not-solatest) DIY tech.

6 customer reviews

a day ago
Totally neccessary adjunct to the Pimoroni Presto, it gives IO capability that is not provided by the original device, working through the I2C interface. Works well, have not yet established speed capabilities but very welcome just the same.
by Trevor about IO Expander Breakout via REVIEWS.io
10 days ago
I bought this to add digital IO pins, ADC input and PWM output to my Presto which has only I2C for Input/Output. It is really easy to connect and I've found it to be really useful.
by Anthony about IO Expander Breakout via REVIEWS.io
4 years ago
Looking forward to use this with the Grow Hat to trigger some Grow LED’s and a float switch for a reservoir.
by Darrell about IO Expander Breakout via REVIEWS.io
4 years ago
Quick delivery. Very useful for multiple analogue inputs. Would be useful to have the option of an un-soldered header, and supplied with spare/loose straight and right-angled headers for end-user soldering (some of us "old school" types don't mind a bit of soldering :-)
by Anonymous about IO Expander Breakout via REVIEWS.io
4 years ago
Great little board, I wish there was a Node-Red node to control it rather than having to revert to a Python node in Node Red. Not knowing Python it took me a little while to get my head around it.
by Christopher about IO Expander Breakout via REVIEWS.io
5 years ago
Nice breakout! Your python-code makes the difference. One thing to note though: the holes of the I2C-connector don't properly line up. Maybe this is on purpose, but in this case it would have made more sense to let the already soldered pins face to the other side.
by Bernhard about IO Expander Breakout via REVIEWS.io

User photos