CircuitPython on Seeed Studio XIAO SAMD21

This wiki introduce how to install and run the official CircuitPython by Adafruit Industries on the Seeed Studio XIAO SAMD21 development board!
CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. It makes getting started easier than ever with no upfront desktop downloads needed. Once you get your board set up, open any text editor, and get started editing code. For more info, please refer to here.
Installing CircuitPython
Download the official CircuitPython Bootloader for Seeed Studio XIAO SAMD21. A
.uf2should be downloaded.Plug-in the Seeed Studio XIAO SAMD21 to your PC via USB Type-C.
Entering the DFU bootloader mode by using a jumper to short connect RST Pins twice quickly. For more reference, please also see here.

- An external drive named
Arduinoshould appear in your PC. Drag the the downloaded CircuitPython uf2 files to theArduinodrive.

- Once loaded the CircuitPython bootloader, unplug the USB Type-C and re-connect. A new external drive called
CIRCUITPYshould appear.

- Now, CircuitPython is loaded on Seeed Studio XIAO SAMD21! All you need to do it's to write you python program and name it
main.pyand drag it onto theCIRCUITPYdrive.
CircuitPyhton Basics
Running Blink using CircuitPython:
Note: simply copy and save the following code and name it main.py, and drag it to CIRCUITPY drive.
import time
import board
from digitalio import DigitalInOut, Direction
led = DigitalInOut(board.LED_INVERTED)
led.direction = Direction.OUTPUT
while True:
led.value = True
time.sleep(1)
led.value = False
time.sleep(1)
You should see the built-in LED starts to blink!
Playing with Grove Modules
You can use Grove modules with simple Analog/Digital Interfaces on CircuitPython. For example, connect Grove - Light Sensor to Seeeduino XIAO's A0 port and run the following:
import time
import board
from analogio import AnalogIn
analog_in = AnalogIn(board.A0) # Analog pin on Seeedino XIAO
def get_voltage(pin):
return (pin.value * 3.3) / 65536
while True:
print("Voltage: ", get_voltage(analog_in))
time.sleep(0.1)

For more CircuitPython API reference, please visit CircuitPython Essentials.
Resourses
Tech Support
Please do not hesitate to submit the issue into our forum.
