The courier showed up today, with a really neat new board from Adafruit – the Feather M0 Express. It is essentially a break out board for the Microchip (formerly Atmel) ATSAMD21G18, which is the same ARM M0+ micro used in the Arduino Zero, plus a 2MB flash memory, RGB LED, and a LiPoly charger. It’s not too expensive at $20USD, nice and tiny, and I think could be a real hit.
Using the Feather M0 Express from Arduino IDE almost couldn’t be easier – just add the Adafruit Board Manager URL to your Arduino IDE settings, then install the “Adafruit SAMD Boards” – instructions at https://learn.adafruit.com/add-boards-arduino-v164 .
However, the really exciting new option available with this new board, is CircuitPython – Adafruit’s implementation of MicroPython. Getting setup for CircuitPython is super easy, though the documentation is still under development so it might seem a bit intimidating at first read. Here’s what I did:
- Download the latest CircuitPython uf2 file for your board from https://github.com/adafruit/circuitpython/releases
- Connect the Feather to your computer via USB
- Put the Feather in to bootloader mode by “double clicking” the reset button. You’ll know it works when the #13 LED starts fading on and off.
- Copy the uf2 file from step 2, on to the FEATHERBOOT USB drive that should have appeared in step 3. Wait a few seconds.
There should now be a USB drive available called CIRCUITPY, and a virtual serial port available.
Using your favourite serial console with the virtual serial port gives an interactive terminal, aka REPL, which can be used directly as below. Or, just save a source file as main.py in the CIRCUITPY drive to get your program to run at boot.
Adafruit CircuitPython 0.9.5 on 2017-04-14; Adafruit Feather M0 Express with samd21g18 >>> print("hi") hi >>> help() Welcome to Adafruit CircuitPython 0.9.5! Please visit learn.adafruit.com/category/circuitpython for project guides. Built in modules: __main__ builtins micropython array (list continues)
Let’s make the “hello world” of embedded programming (but this time, done on-target using tab completion!):
>>> import digitalio >>> import board >>> import time >>> with digitalio.DigitalInOut(board.D13) as led: ... led.switch_to_output() ... while True: ... led.value = 1 ... time.sleep(0.5) ... led.value = 0 ... time.sleep(0.5)