The ItsyBitsy M4 Express uses the Microchip ATSAMD51 Cortext M4 processor running at 120 MHz, with floating point support and 512KB Flash and 192KB RAM. It's quite tiny, at 35mm long by 18mm wide, and has 6 power pins, 23 digital GPIO pins (7 of which can be analog in, 2 x 1 MSPS analog out DACs, and 18 x PWM out). It has 2MB of SPI Flash memory to contain your program code. It receives both its power and connection to the outside world via a micro USB connection.
The ItsyBitsy can be programmed in CircuitPython, and from AdaFruit comes preinstalled with a CircuitPython UF2 bootloader. You can install an alternative bootloader if you want to program it in some other language, but we're happy with CircuitPython.
The steps are:
- create your Python code in a file named "code.py" or "main.py"
- attach the ItsyBitsy to your computer using a USB cable. It should show up as a drive named "CIRCUITPY" on your desktop. The LED on the M4 Express will glow green.
- drag-and-drop your python file onto the mounted drive
- push the tiny reset button once. The ItsyBitsy will load and execute the code.py file
If you want to update your code just drag a new version onto the drive. You should see the results immediately as the M4 Express senses a change in the file.
Example Python Code#
This file, named "code.py" causes the little red LED on the ItsyBitsy to blink:
import board import digitalio import time led = digitalio.DigitalInOut(board.D13) led.direction = digitalio.Direction.OUTPUT while True: led.value = True time.sleep(0.8) # how much time on? led.value = False time.sleep(1.8) # how much time off?
Intercommunication with a Raspberry Pi#
This can be done with Firmata, a protocol not unlike Midi.
- Raspberry Pi (master) Arduino (slave) I2C communication with WiringPi
- Raspberry Pi (master) Arduino Uno (slave) SPI communication with WiringPi