The Raspberry Pi Pico is a microcontroller board similar to a BBC Microbit, CodeBug, or Arduino device (e.g. an Adafruit Gemma) but it has more power because of its chip, which was specially designed by the Raspberry Pi people. It has the advantage over a Pi Zero, for projects where you need a small board, that it is very easy to get it to start headless (without screen and keyboard). That’s one problem I have grappled with before – but on the Pico you just save the code you want, to start headless, as main.py and whenever you plug it in to a power source the code runs.
It can be coded using any kind of computer which has a MicroPython editor but I used a Raspberry Pi 3B because that’s what I had handy and it has a good python editor called Thonny.
Follow the instructions here: https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico or buy or download for free the book, “Getting started with MicroPython on Raspberry Pi Pico” from here: https://hackspace.raspberrypi.org/books/micropython-pico
NB If you’re using a Raspberry Pi, make sure your R Pi Operating System is the latest version and is updated and upgraded so that you have the latest version of Thonny. I wasted a lot of time using my old R Pi 2B as the version of Thonny did not recognise Pico MicroPython.
After some revision (because I’d forgotten about resistors and their values), I watched this video: Take a peek at the new Raspberry Pi Pico with Eben Upton! – Raspberry Pi and in the second half Mr C shows you how to use an LED with a potentiometer (trimpot or trim potentiometer) to light up the LED and control its brightness. I was very nervous that I might blow the LED or the Pico but, after sorting out a bug in my code, it worked:
I altered Mr C’s code a little but I think the only important thing was to import PWM which I did not see in Mr C’s code.
The result was this:
and when I turned the potentiometer knob the LED’s brightness changed. (You can only just see the little blue potentiometer next to the LED.)
I’d never used a potentiometer (trimpot) before and I learnt a lot wiring it up and checking if it did indeed vary the brightness of the LED.
So this was a very successful start on my Pico’s Progress.