We're constantly updating and improving our libraries which provide functionality to CircuitPython. You can find example code in the guides for your board that depends on external libraries. Some of these libraries may be available from Adafruit, some may be written by community members.
Either way, as you start to explore CircuitPython, you'll want to know how to get libraries on board.
You can grab the latest Adafruit CircuitPython Bundle release by clicking the button below.
Once you've finished setting up your GEMMA M0 with CircuitPython, you can add the libraries to the lib folder of the GEMMA's CIRCUITPY drive which should appear when the board is plugged into your computer via a known good USB cable.
Copy this folder:
- adafruit_bus_device
And these files:
- adafruit_dotstar.mpy
- adafruit_pypixelbuf.mpy
To the CIRCUITPY flash drive /lib directory (create the directory if it doesn't exist).
Then, you can click on the Download: Project Zip link in the window below to download the code file. Take code.py from this zip and put it in the main (root) directory of the CIRCUITPY drive.
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries # # SPDX-License-Identifier: MIT import time import adafruit_dotstar from rainbowio import colorwheel import board import touchio pixel = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=.1) touch = touchio.TouchIn(board.D1) hue = 0 while True: hue = hue + touch.value * 3 if hue > 255: # Wrap back around to red hue = hue - 255 pixel[0] = colorwheel(hue) time.sleep(.05)
Review
Make sure you've followed these steps:
- Loaded all the required library files and directories into the CIRCUITPY /lib directory
- Copied code.py to the main (root) directory of the CIRCUITPY drive
Your GEMMA M0's CIRCUITPY drive should look like this after you load the libraries and code.py file.
The storage available in the GEMMA M0 is limited. If you're having trouble getting the files and folders to fit, check out these troubleshooting steps.
Press and hold a fingertip against the "D1" pad. The DotStar LED should cycle through a rainbow of colors while D1 is touched, and show a solid color when D1 is not touched. If it doesn't, make sure you copied the files and folders as shown above. If you're still stuck, you can use the CircuitPython REPL in Mu to troubleshoot the problem by viewing possible error messages.
Page last edited January 21, 2025
Text editor powered by tinymce.