Hello... I'm really confused with the Char and String things in Arduino - If I can just describe briefly what I'm trying to do.
Ii'm using the Adafruit WaveHC library and trying to play a WAV.
Now, to save RAM I've named all my WAVs with 5 digits e.g 12001.
So if I do playFileNew (12103); I want it to play 12103.WAV. So I would assume it would just be converting the integer to a string and adding on ".WAV"
Now the original code looks more like this
e.g
playFile ("song.wav")
void playFile(char *name) {
if (!file.open(root, name)) {
Serial.print(F("\n playfile: Couldn't open file: "));
Serial.println(name);
return;
}
}
So the question is how to I convert the incoming "12001" into "12001.WAV" to be opened in the playFile ?
I would have thought it would be something like:
Change the playFileNew to accept integers to -- > void playFile(long lName, boolean playComplete) {}
note: I had to use long as for some reason it would not pass 12003 as an integer.
soundFile = convert to String (lName) + ".WAV";
But then this does not work in -- > if (!file.open(root, soundFile)) {
Does this make sense?
Thanks in advance