Maximillan Brown
Published

Wooden Keytar

A keytar that plays a note when the tin foil is touched.

BeginnerShowcase (no instructions)390
Wooden Keytar

Story

Read more

Code

CPX piano code

Python
Code is a combination of the examples "Pixel fill rainbow" and "Play file."
"""This example uses the capacitive touch pads on the Circuit Playground. They are located around
the outer edge of the board and are labeled A1-A6 and TX. (A0 is not a touch pad.) This example
lights up all the NeoPixels a different color of the rainbow for each pad touched!"""
import time
from adafruit_circuitplayground import cp

cp.pixels.brightness = 0.0

while True:
    if cp.touch_A1:
        print("Touched A1!")
        cp.play_file("piano1final.wav")
    if cp.touch_A2:
        print("Touched A2!")
        cp.play_file("piano2final.wav")
    if cp.touch_A3:
        print("Touched A3!")
        cp.play_file("piano3final.wav")
    if cp.touch_A4:
        print("Touched A4!")
        cp.play_file("piano4final.wav")
    if cp.touch_A5:
        print("Touched A5!")
        cp.play_file("piano5final.wav")
    if cp.touch_A6:
        print("Touched A6!")
        cp.play_file("piano6final.wav")
    if cp.touch_TX:
        print("Touched TX!")
    #time.sleep(0.1)

Credits

Maximillan Brown
4 projects • 0 followers

Comments