I don’t know when I purchased this book, but I’m pretty sure it was 2018. The publishing date is October 2017. When I first saw the book I was pleasantly surprised there was an official O’Reilly book on the subject. Up to that point it’d been something of a hobby language for me on Adafruit’s Circuit Express (CircuitPython) and the BBC’s micro:bit v1 (MicroPython). If you don’t know already, CircuitPython is a fork of MicroPython with some unique to-Adafruit touches.
For those who might want to purchase a copy of their own, here’s the link to get you started: https://www.oreilly.com/library/view/programming-with-micropython/9781491972724/
The book is nearing four years after initial publication, which is a very long time in the business of dead-tree computer texts. If the author worked with a then-current release of MicroPython, then that would be one of the version 1.9 point releases. Today, MicroPython is at 1.18, and quite a bit has been fixed and added along the way. Let me illustrate by way of an example using the Raspbery Pi Pico with the RP2040 dual-core microcontroller.
One of the very first programs that is offered in any language is “Hello, World!” It’s usually anywhere from a single line, up to several, depending on the language. To illustrate how easy it is to get started in physical computing and IoT programming, all languages ported to computers such as the Raspberry Pi or the Pi Pico have extensions and modules that allow you to interact with external electrical devices, such as an LED. Thus the equivalent of “Hello, World!” in this context is blinking an LED. Using a Raspberry Pi Pico with MicroPython version 1.18 installed, this is what that looks like. I’ll be typing this in to the REPL.
>>> from machine import Pin, Timer >>> led = Pin(25, Pin.OUT) >>> timer.init(period=500, mode=Timer.PERIODIC, callback=lambda t:led.toggle()) >>>
In three lines of code, we imported libraries that are part of the main MicroPython installation, set up a variable to manipulate the built-in physical LED attached to GPIO pin 25, and then used a Timer class instance to toggle the LED every 500 mS, or every 1/2 second. When you look on the Pico board after executing
timer.init(...), the on-board green LED is indeed flashing every 1/2 second. You would not have found any of this in the current book. I found it quite by accident while looking for something else in the current MicroPython online documentation here: https://docs.micropython.org/en/latest/rp2/quickref.html .
This isn’t to say the book is bad. it still has a large amount of good information to convey if you approach the material as a starting point. Chapter 13 in particular gives excellent advice on how to write good idiomatic MicroPython on these microcontrollers, advice which is still relevant today. What needs to be done to produce a second addition is
- cover updates to some of the micro controller boards, for example
- micro:bit version 2,
- Adafruit’s Circuit Playground Bluetooth,
- an updated ESP32,
- the ESP32-C3 with RISC-V that replaces the ESP-8266,
- and the Raspberry Pi Pico/RP2040 (and Adafruit’s Feather RP2040).
- cover the updates from MicroPython v 1.9 to today’s version (which is currently at 1.18),
- add coverage to Adafruit’s Circuit Python
- document real examples of CircuitPython/MicroPython on real space hardware, citing PyCubed ( https://pycubed.org ) and the V-R3x space mission ( http://vr3x.space ), just to name two examples here.
Quite a bit has advanced over the last four years, and needs to be captured in a second edition. I wish I could help, but I don’t have the original document to work from. I’m not about to say writing a second edition would be easy. I’ve written enough proposals and technical manuals in my days to appreciate the effort required to write clearly, correctly, and engagingly to your audience. But I do wish I could help bring about a second edition, if nothing else by supporting the original author.