But what happens when we have more than two sounds? Two buttons is simply not enough for the cool things that we want to do.
Well, we are in luck. Circuit Playground Express comes with multiple capacitive touch sensors.
This quick-start example shows how you can read the capacitive touch sensors built into SEVEN of the Circuit Playground Express pads (pad
A0 is not a capacitive touch pad).
A7 can be used as capacitive devices and to access them, we can use:
In this exercise, we are going to add some code to the
while loop so that there will be a musical note for each touch sensor.
while loop, we are going to add some
cpx.touch_A1 is touched:
cpx.touch_A2 is touched:
cpx.touch_A3 is touched:
cpx.touch_A4 is touched:
Click the Download button to download the code.py file.
Drag and drop the downloaded file into the CIRCUITPY drive on your computer.
Note: No extra hardware is required, you can touch the pads directly, but you may want to attach alligator clips or foil tape to metallic or conductive objects. Try silverware, fruit or other food, liquid, aluminum foil, and items around your desk!