LibrariesWith all of the necessary libraries installed, your CLUE should look like this.
|
|
Pose BitmapsYou'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. |
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.
Code
Copy the code from the code-block below and paste it into the Mu editor and save it to your CLUE as code.py (or copy code.py from the zip file and place on the CIRCUITPY drive).
# 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()
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