Pages

Wednesday, 27 January 2021

Which Python should you install on your Raspberry Pi Pico?

 The new Raspberry Pi Pico sold out soon after launch. One of the reasons it's so popular is that you can program it in Python.

There are two versions of Python to consider: MicroPython and CircuitPython. Fortunately they are very easy to install or replace and they are very similar. Let's compare them so you can decide which to use.

The Official guide to the Pico (reviewed here)recommends that you install the official version of MicroPython. MicroPython has been around since 2014, and it's been ported to quite a few boards. It was  created by Damien George, and he is responsible for the port to the Pico.

If you're starting with MicroPython and  want to work your way through the Official Guide, use the official version.

If you've been using MicroPython for a while you've probably heard of CircuitPython. It's based on MicroPython but  adapted by the inventive folk at Adafruit. 

CircuitPython lets you run the same program on any supported board without having to change it. If you use the Adafruit add-ons (or any of the other compatible products) you can use the same code to drive them on any CircuitPython-enabled board. 

Adafruit even have software called Blinka which lets you run the same code on a Raspberry Pi or  Jetson Nano!

CircuitPython makes it easy to move your code from one environment to another, and it supports a huge range of add-on devices from Adafruit and other vendors. At present, though, the Pico version is in beta-test and some features have not been implemented. I'm experimenting with it but I'd advise most Pico users to stick with the official version for now.

In the Pico posts I have planned, most of my code will run on both versions without change. I may occasionally write code that relies on some of the CircuitPython extensions. I'll make it clear when I do!

The next blog post will cover using PySerial to drive a Pico form a Host Computer. The Pico can be running MicroPython or CircuitPython.

To keep up to date with this series follow @rareblog on twitter.

No comments:

Post a comment