Now that you've got your pieces assembled and have CircuitPython installed on the Feather STM32F405 Express, all you have to do is is copy over a bit of code we've written to make the whole thing go. Before you continue, you'll want to make sure that your Feather is plugged into your machine and your operating system file explorer/finder has the board showing up as a drive named CIRCUITPY.

Installing Project Code

To use with CircuitPython, you need to first install a few libraries, into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.

Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, open the directory REPLACE/ and then click on the directory that matches the version of CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive.

Your CIRCUITPY drive should now look similar to the following image:

CIRCUITPY
# SPDX-FileCopyrightText: 2020 Bryan Siepert for Adafruit Industries
#
# SPDX-License-Identifier: MIT

import puff_detector

detector = puff_detector.PuffDetector()


@detector.on_sip
def on_sip(strength, duration):
    if strength == puff_detector.STRONG:
        print("GOT STRONG SIP")
    if strength == puff_detector.SOFT:
        print("GOT SOFT SIP")
    print("%.2f long" % duration)


@detector.on_puff
def on_puff(strength, duration):
    if strength == puff_detector.STRONG:
        print("GOT STRONG PUFF")
    if strength == puff_detector.SOFT:
        print("GOT SOFT PUFF")
    print("%.2f long" % duration)


detector.run()

Sip and Puff code on GitHub

If you wish to access the code on GitHub, it can be found in this directory

The board should come up with the starting screen! If you see any errors, check the Mu editor's REPL for warnings or failures

This guide was first published on Feb 17, 2020. It was last updated on Jun 23, 2024.

This page (CircuitPython Code) was last updated on Jun 22, 2024.

Text editor powered by tinymce.