Text Editor

Adafruit recommends using the Mu editor for editing your CircuitPython code. You can get more info in this guide.

Alternatively, you can use any text editor that saves files.

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 Yoga_Pose_Chime/ 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 John Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT

# Yoga pose timer
# Requires CLUE with solenoid transistor driver circuit

import time
import board
from digitalio import DigitalInOut, Direction
from adafruit_clue import clue
from adafruit_slideshow import SlideShow, PlayBackDirection

pose_time = 30  # choose the time to hold each pose in seconds

solenoid = DigitalInOut(board.D2)  # pad #2 on CLUE driving a MOSFET
solenoid.direction = Direction.OUTPUT
solenoid.value = False

def chime(repeat):
    for _ in range(repeat):
        solenoid.value = True
        time.sleep(0.03)
        solenoid.value = False
        time.sleep(0.25)

slideshow = SlideShow(clue.display, None, folder="/icons", auto_advance=False)

while True:
    if clue.proximity > 10:
        time.sleep(1)
        chime(1)
        time.sleep(pose_time)
        chime(2)
        slideshow.direction = PlayBackDirection.FORWARD
        slideshow.advance()

    if clue.button_b:  # skip ahead
        slideshow.direction = PlayBackDirection.FORWARD
        slideshow.advance()

    if clue.button_a:  # skip back
        slideshow.direction = PlayBackDirection.BACKWARD
        slideshow.advance()

Pose Bitmaps

You'll need to load some compatible bitmap files onto your CIRCUITPY drive. We've included a series of Yoga pose icons from svgrepo.com that are Creative Commons licensed.

To use them, first download the .zip file linked below, and uncompress it. Create a directory on the CLUE's root level called icons. Then, copy a few pose .bmp files into the icons folder.

For information on how to create your own compatible bitmaps, check out the Customization section of the Notifcation Icons page in this guide.

How to use the Yoga Pose Chime

  • Turn on both battery packs first, so the CLUE turns on and the solenoid can be triggered
  • You'll begin the first pose timer by waving your hand close to the CLUE's proximity sensor which is mounted right above the screen
  • The solenoid triggers once to chime the bowl, signaling the pose can begin
  • After 30 seconds (or your chosen interval time) the solenoid will chime twice, signaling the end of the pose
  • You can press the B button on the CLUE to skip ahead to a different pose, the A button to go back to a pose

This guide was first published on May 20, 2020. It was last updated on Mar 27, 2024.

This page (Code the Yoga Pose Chime in CircuitPython) was last updated on Mar 27, 2024.

Text editor powered by tinymce.