I have a series of files on my SD card that I want played in order each time the code loops. The files are named HELLO1.wav HELLO2.wav etc. I have so far got
if (HELLO = 5) {
HELLO = 1;
} // there are 4 HELLO files. The loop adds 1 each time so if the number is greater than the number of files, it resets to the first file.
Wire.beginTransmission(9); // I am transmitting to another arduino with the Adafruit Music Maker shield
String HELLOcommand = '/HELLO' + HELLO + '.wav'; // so HELLO is an int defined as starting at 1. This HELLOcommand is supposed to combine /HELLO and the int and .wav to give, for example. /HELLO1.wav as the filename to play. This is where the code is getting stuck.
Wire.write(HELLOcommand);
Wire.endTransmission();
++HELLO;
This is giving me an error Conversion from int to String is ambiguous
Doesn't seem very ambiguous to me! I am more used to coding in Excel, and Visual Basic, which I know is different but they share some similarities. I would just get the result I want by using & usually, but here I am stuck. Any advice? Thanks!!
why not just use a if statement to output the desired wave file to play with the condition of the hello int matching instead of using a string? its more lines of code but it should do the thing ... with the stuff
Lots of ways to do it, I use itoa a lot.
char Txt[20]={};
int yourINT=1;
Lots of ways to do it, I use itoa a lot.
strcpy(Txt, "/hello");
itoa(yourINT, Txt + strlen(Txt), 10);
strcat(Txt, ".wav");
Why don't you just tell me? Why are you being cryptic? You already have the knowledge, and you are clearly prepared to spend time writing a reply, why don't you use that time to explain what the problem is and then just write the solution, instead of dropping cryptic hints?