I have 48 piezo sensor wired up to three multiplexers (mux shield). Reading the analog pins ( A0 -A2 ) if one of the sensors are active a corresponding midiNote (a bifferent one for each sensor) is triggered. I'm trying to trigger a specific mp3file of each sensor.
I am very new to coding and arduino and new some help programming the conditions/events.
how do I trigger a specific mp3file using analogRead and an array.
My thinking thus far is something like this:
Code: Select all
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SFEMP3Shield MP3player;
Code: Select all
for (int i=0; i<16; i++)
{
if(analogPin==0)
{
if (activePad[pad])
MP3Player.PlayTrack(Pad[i]);
else
MP3player.stopTrack();
}
when one of the sensors are active the corresponding mp3 should play, when no pad is active no mp3 plays
Do i have to list all the mp3s in a array in the sketch?
Please find the code as it stands now attached. (MP3 part not yet added)
Any help would be greatly appreciated
Thanks much