Getting Familiar

CircuitPython is a programming language based on Python, one of the fastest growing programming languages in the world. It is specifically designed to simplify experimenting and learning to code on low-cost microcontroller boards.

CircuitPython is easiest to use within the Mu Editor. If you haven't previously used Mu, this guide will get you started.

If you haven't used Circuit Playground Express and CircuitPython together before, make sure you've updated it with the latest version of CircuitPython. This guide will show you how.

Copy that Code!

Plug your Circuit Playground Express into your computer (mac/PC/Linux) via a known good USB A to micro-B cable. Your board should appear to the computer as a flask disk drive named CIRCUITPY. If you see a disk name CPLAYBOOT, try to press the reset button again. If the only drive name you get is CPLAYBOOT, CircuitPython may not be loaded on the board. You can load CircuitPython per this guide.

Copy from the link below and put it in CIRCUITPY root directory. You can work with this code in any text editing application, or open and save with Mu if you prefer. 

# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
# SPDX-License-Identifier: MIT

# Interactive Map
# for Adafruit Circuit Playground express
# with CircuitPython

from import cpx

# Change this number to adjust touch sensitivity threshold, 0 is default

WHITE = (30, 30, 30)
RED = (90, 0, 0)
YELLOW = (45, 45, 0)
GREEN = (0, 90, 0)
AQUA = (0, 45, 45)
BLUE = (0, 0, 90)
PURPLE = (45, 0, 45)
BLACK = (0, 0, 0)

cpx.pixels.brightness = 0.1  # set brightness value

# The seven files assigned to the touchpads
audio_file = ["01.wav", "02.wav", "03.wav",
              "04.wav", "05.wav", "06.wav",

# NeoPixel colors

def play_it(index):
    cpx.pixels.fill(step_col[index])  # Light lights
    cpx.play_file(audio_file[index])  # play clip
    print("playing file " + audio_file[index])
    cpx.pixels.fill(BLACK)  # unlight lights

while True:
    # playback mode

    if cpx.touch_A1:
    if cpx.touch_A2:
    if cpx.touch_A3:
    if cpx.touch_A4:
    if cpx.touch_A5:
    if cpx.touch_A6:
    if cpx.touch_A7:

Once the code is saved to CIRCUITPY, drag your audio files over too. You should be able to test that they play by touching the capacitive pads, the miniature speaker on the board will play them (but for higher fidelity and more volume, connecting external speakers is recommended).


Problem: My Circuit Playground Express isn't recognized by Mu!

Solution: Make sure your board is set up with CircuitPython, which has the Circuit Playground Express show up as a flash drive named CIRCUITPY when you connect the CPX to your computer. If it is showing up as CPLAYBOOT on your computer, you can follow the steps in this guide to ensure CircuitPython is loaded and you see the CIRCUITPY drive.


Problem: I can't hear any audio!

Solution: Check that your Circuit Playground Express is connected to your battery pack and the slide switch on pack is set to "ON". 


Problem: I STILL can't hear any audio!

Solution: Check that your audio files are all named correctly, 01.wav to 07.wav. Don't forget those leading zeroes!

This guide was first published on Dec 07, 2018. It was last updated on 2023-12-04 14:48:01 -0500.

This page (CircuitPython Code) was last updated on Dec 04, 2023.

Text editor powered by tinymce.