Hello, I am a sound artist that is relatively new to working with an Arduino. I am attempting to build a system, where touching a capacitive sensor will trigger a sound file to play, and the sound file will continue to play so long as the touch is present. Once the sensor is not triggered, the sound file stops playing.
I have an Arduino Uno.
I’m really not sure where to start with the coding, and if I’ll need an external amplifier to power a small speaker, or if the Arduino is capable of doing so. I’ve found other codes for a separate mp3 player or a simple capacitive touch sensor, but I’m having trouble working out how to assemble it all together, so any help would be much appreciated. I apologize in advance for my absolute lack of Arduino knowledge!
Follow the example code that comes with the library or
run some tutorials for the hardware selected.
If you are happy with the results of the tutorials you can merge these to your project.
The hard part: "while the sensor is being touched".
Capacitive sensors usually self-calibrate, so a touch longer than a second or so becomes the new base state. Otherwise the connected fruit may make them read "touched" forever...
In your case a distance sensor may be the better solution. They can detect the presence of a hand or something else "touching" indefinitely, and tell you reliably when it's removed again.