Hello, im going to try and make this post be clearer than my last ones. This is a simple question. I have been doing research into variables and with help from people here im comfortable using them and such.
Now my question is with an example. My current function is setup as
playWAV('a', na_volume) the function is playWAV(char effect, na_volume) because it is in a case list. What i want to know is can i move from 'a' variables to 'alarm1' Is this even possible? I thought maybe strings but couldnt understand them.
void playWAV (char effect, int na_volume)
{
Serial.println("Entered playWAV");
switch (effect)
{
case 'a':
file = new AudioFileSourceSD("/wav/alarm.wav");
break;
case 'b':
file = new AudioFileSourceSD("/wav/alarmhigh.wav");
break;
case 'c':
file = new AudioFileSourceSD("/wav/alarmlow.wav");
break;
case 'd':
file = new AudioFileSourceSD("/wav/error.wav");
break;
Can you provide an example of this? first time hearing about it. (and thank you, ive been getting a lot of people rude around here assuming im an idiot. So thank you for not being that way, its much appriciated.
so if ive got it right, char buffer [40]; would i change the 40 or not?
i get the "wav/%s.wav I would put the path there correct? and the name would be manually specified on that line too correcty?
You'd only change the 40 if the pathname could exceed 39 characters.
The string pointed to by "name" will replace the %s, and you simply use "buffer" to open the file.