I am getting this error from the Visual Studio compiler (I use the Visual Studio add-in Visual Micro for Arduino).
ModelRailroadCrossingSignalController.ino:In function 'void loop() ModelRailroadCrossingSignalController.ino:210:15: error: too few arguments to function 'Adafruit_VS1053_FilePlayer onSignalSound(Adafruit_VS1053_FilePlayer, const char*) :onSignalSound() ModelRailroadCrossingSignalController.ino:note declared here :Adafruit_VS1053_FilePlayer onSignalSound(Adafruit_VS1053_FilePlayer mp, const char* fileName) { Error compiling project sources
Here is the function and loop (all the defines and instances left out for brevity, they aren't the issue
void loop() {
// put your main code here, to run repeatedly
signalEntrySensor = checkEntrySensor();
if (signalEntrySensor == true) {
if (crossingSignalInOperation == false)
{
Adafruit_VS1053_FilePlayer mp = onSignalSound(musicPlayer,"Trainxng.mp3"); //all other functions are called in the sound routine?
if (debugMode)
{
Serial.println("Sound byte called");
}
while (mp.playingMusic) {
// file is now playing in the 'background' so now's a good time
// to do something else
offRoadPower();
lowerSignalArms();
onSignalSound();
startSignalFlashers();
crossingSignalInOperation = true;
}
}
}
Adafruit_VS1053_FilePlayer onSignalSound(Adafruit_VS1053_FilePlayer mp, const char* fileName) {
// Play the train crossing sound file
if (debugMode)
{
Serial.println(F("Playing track - "));
Serial.print(fileName);
}
//all sound files are on the micro sd card on the music player shield
if (!mp.startPlayingFile(fileName)) {
Serial.println(F("Could not open file "));
Serial.print(fileName);
while (1);
}
return mp; }
I'm a C# guy, not ever using C++ until now, but this code should certainly work, not sure why the function is not compiling.