Pages

Saturday, 13 February 2021

MicroPython development on the Raspberry Pi Pico

Get Started with MicroPython on Raspberry Pi Pico suggests that you use the Thonny editor for development.

Thonny will get you off to a quick start, but you may have an alternative editor you'd prefer to use.

Lots of my friends now use VS Code; some are vim or emacs experts; many, like me, use PyCharm as their normal Python development environment.

I find it more comfortable to use my normal editor for MicroPython development, but I have more compelling reasons.

The first is refactoring support. I'm learning as I go, and I often want to improve the design of my code libraries as I come to understand things better. PyCharm does a very good job of refactoring Python code.

There's another issue to do with version control.

I'm currently sharing my Pico code on GitHub. That means I need to keep code on the Pico in sync with the code on my workstation. I haven't found an easy way to do that with Thonny, so I am using another tool to move and test code.

rshell was my first choice, but I've had some problems with it, as have others.  Les Pounder (@biglesp) came to my rescue. He has a really useful series of blog posts called Tooling Tuesday.

A while ago Les recommended Adafruit's ampy for use with MicroPython boards. Ampy works really well with the Pico. I now have it on my workstation, and on a Raspberry Pi which I also use for Pico development.

Les also recommends tio for serial communications. tio is a serial terminal program. Its great advantage over others is that it will try to reconnect automatically if the serial link goes down. tio is available on the Pi but I couldn't find it in the official repositories for my very backdated Linux Mint installation. Fortunately it took just three minutes to download tio and build it from source, following the instructions on its GitHub page.

I'll soon be publishing more Pico and Tiny2040 code. If you want to stay up to date, follow me (@rareblog) on twitter.


No comments:

Post a Comment