The following sketch uses the Circuit Playground speaker to play a different tone for each pad when touched.
Look in the
takeAction() function and you will see a call to
playTone() for each of the pads. The frequencies correspond to the basic musical notes. With this sketch loaded and running on the Circuit Playground, you should hear different tones played when a pad is touched.
We can use alligator clips and some paper to create a little piano. On a 6"x4" index card or other piece of paper, draw something similar to the picture below.
Now attach the alligator clips to the edge of the paper and the Circuit Playground as shown below.
Once you've clipped the alligators, press the reset button on the Circuit Playground so it will re-calibrate the capacitive touch sensors
To play a note, just touch the alligator clip on the edge of the paper. For example, in the picture below, E is being played.
Try out the following sequence of notes.
Do you recognize the tune? Here's a hint.