Adafruit Metro M0 Express - Designed for CircuitPython
Created by lady ada
Last updated on 2018-10-05 07:06:01 AM UTC
Guide Contents
Guide Contents
Overview
Pinouts
Power Connections
Logic pins
Top Row
Bottom Row
Right side
Additional analog inputs
2
8
12
12
13
14
14
14
14
SPI Flash and NeoPixel
Other Pins!
Debug Interface
SEGGER J-Link EDU - JTAG/SWD Debugger
SEGGER J-Link BASE - JTAG/SWD Debugger
JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board
10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm long
14
15
16
17
17
17
18
UF2 Bootloader Details
Entering Bootloader Mode
Using the Mass Storage Bootloader
Using the BOSSA Bootloader
Windows 7 Drivers
Verifying Serial Port in Device Manager
Running bossac on the command line
19
19
21
22
22
23
24
Updating the bootloader
Getting Rid of Windows Pop-ups
Making your own UF2
Arduino IDE Setup
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
25
26
27
28
29
Using with Arduino IDE
Install SAMD Support
Install Adafruit SAMD
Install Drivers (Windows 7 & 8 Only)
Blink
Successful Upload
Compilation Issues
Manually bootloading
Ubuntu & Linux Issue Fix
Adapting Sketches to M0
Analog References
Pin Outputs & Pullups
Serial vs SerialUSB
AnalogWrite / PWM on Feather/Metro M0
© Adafruit Industries
https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython
31
31
31
33
34
35
35
36
36
37
37
37
37
38
Page 2 of 177
analogWrite() PWM range
Missing header files
Bootloader Launching
Aligned Memory Access
Floating Point Conversion
How Much RAM Available?
Storing data in FLASH
Pretty-Printing out registers
Using SPI Flash
Read & Write CircuitPython Files
Format Flash Memory
Datalogging Example
Reading and Printing Files
Full Usage Example
Accessing SPI Flash
Metro M0 HELP!
39
39
39
39
40
40
40
40
42
42
44
45
46
46
47
49
My Metro M0 stopped working when I unplugged the USB!
49
My Metro never shows up as a COM or Serial port in the Arduino IDE
49
Ack! I "did something" and now when I plug in the Metro, it doesn't show up as a device anymore so I cant
upload to it or fix it...
49
I can't get the Metro USB device to show up - I get "USB Device Malfunctioning" errors!
49
I'm having problems with COM ports and my Metro M0
49
I don't understand why the COM port disappears, this does not happen on my Arduino UNO!
50
I'm trying to upload to my 32u4, getting "avrdude: butterfly_recv(): programmer is not responding" errors
50
I'm trying to upload to my Metro M0, and I get this error "Connecting to programmer: .avrdude: butterfly_recv():
programmer is not responding"
50
I'm trying to upload to my Metro and i get this error "avrdude: ser_recv(): programmer is not responding"
50
What is CircuitPython?
CircuitPython is based on Python
Why would I use CircuitPython?
51
51
51
CircuitPython
Set up CircuitPython Quick Start!
Further Information
53
53
55
Installing Mu Editor
Installing Mu for Windows or Mac OS X
56
56
Installing Mu for Linux
Using Mu
Mu Packages
56
56
57
Creating and Editing Code
Creating Code
Editing Code
Your code changes are run as soon as the file is done saving.
58
58
60
60
1. Use an editor that writes out the file completely when you save it.
2. Eject or Sync the Drive After Writing
Oh No I Did Something Wrong and Now The CIRCUITPY Drive Doesn't Show Up!!!
60
61
61
Back to Editing Code...
© Adafruit Industries
https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython
61
Page 3 of 177
Exploring Your First CircuitPython Program
Imports & Libraries
Setting Up The LED
Loop-de-loops
61
62
62
62
More Changes
Naming Your Program File
Connecting to the Serial Console
Are you using Mu?
Using Something Else?
Interacting with the Serial Console
The REPL
Returning to the serial console
CircuitPython Libraries
Installing the CircuitPython Library Bundle
Express Boards
Non-Express Boards
Example: ImportError Due to Missing Library
Library Install on Non-Express Boards
Updating CircuitPython Libraries
63
63
64
64
65
66
69
72
74
74
75
75
76
77
77
Troubleshooting
CPLAYBOOT, TRINKETBOOT, FEATHERBOOT, or GEMMABOOT Drive Not Present
You may have a different board.
MakeCode
Windows 10
Windows 7
78
78
78
78
78
78
Windows Explorer Locks Up When Accessing boardnameBOOT Drive
CIRCUITPY Drive Does Not Appear
CircuitPython RGB Status Light
ValueError: Incompatible .mpy file.
CIRCUITPY Drive Issues
Easiest Way: Use storage.erase_filesystem()
Old Way: For the Circuit Playground Express, Feather M0 Express, and Metro M0 Express:
Old Way: For Non-Express Boards with a UF2 bootloader (Gemma M0, Trinket M0):
Old Way: For non-Express Boards without a UF2 bootloader (Feather M0 Basic Proto, Feather Adalogger,
Arduino Zero):
79
79
79
80
80
80
81
81
82
Running Out of File Space on Non-Express Boards
Delete something!
Use tabs
Mac OSX loves to add extra files.
Prevent & Remove Mac OSX Hidden Files
Copy Files on Mac OSX Without Creating Hidden Files
Other Mac OSX Space-Saving Tips
82
82
82
82
83
83
84
Welcome to the Community!
Adafruit Discord
Adafruit Forums
Adafruit Github
ReadTheDocs
© Adafruit Industries
https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython
86
86
87
88
89
Page 4 of 177
Advanced Serial Console on Windows
Windows 7 Driver
What's the COM?
Install Putty
Advanced Serial Console on Mac and Linux
What's the Port?
Connect with screen
Permissions on Linux
Uninstalling CircuitPython
Backup Your Code
90
90
90
91
93
93
95
96
98
98
Moving to MakeCode
Moving to Arduino
CircuitPython Essentials
CircuitPython Built-Ins
Thing That Are Built In and Work
Flow Control
Math
Tuples, Lists, Arrays, and Dictionaries
Classes, Objects and Functions
Lambdas
Random Numbers
98
99
101
102
102
102
102
102
102
102
102
CircuitPython Digital In & Out
Find the pins!
Read the Docs
103
104
106
CircuitPython Analog In
Creating the analog input
get_voltage Helper
Main Loop
Changing It Up
Wire it up
107
107
107
107
108
108
CircuitPython Analog Out
Creating an analog output
Setting the analog output
Main Loop
Find the pin
112
112
112
112
113
CircuitPython PWM
PWM with Fixed Frequency
Create a PWM Output
Main Loop
PWM Output with Variable Frequency
Wire it up
Where's My PWM?
117
117
117
117
117
118
122
CircuitPython Servo
Servo Wiring
Servo Code
123
123
125
CircuitPython Cap Touch
© Adafruit Industries
https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython
126
Page 5 of 177