.wav player have problem.

:confused:

I’m new to that. :frowning: Trying to make a simple vaw player. But I have a problem.

C:\Users\sanderman\Desktop\firstproject\deneyecek.ino: In function 'void setup()':

C:\Users\sanderman\Desktop\deneyecek\firstproject.ino:13:31: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

  if(!SdPlay.setFile("test.wav"))

I do not know what will I do? please help me.

#include <SimpleSDAudio.h>
  
void setup()
{  
 SdPlay.setSDCSPin(4);
 if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER))
 {
 while(1); 
 } 
 
 if(!SdPlay.setFile("test.wav")) 
 {
 while(1);
 } 
}
  
void loop(void) {
 SdPlay.play(); 
 while(!SdPlay.isStopped()) { 
 ; 
 }
}

The warning means the person who wrote the library you're using was a sloppy programmer. You can safely ignore this warning.

You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings not errors.

You should always pay attention to warnings and fix them in your own code whenever possible. Unfortunately some library authors don't hold themselves to such high standards so sometimes you do just need to ignore a warning from a library that you didn't write. That can be quite annoying since you are always having to sort though a bunch of warnings in other people's sloppy code to make sure your own code is of high quality. You may decide it's worth editing the source of the library to fix the warning. If you do so, it's a good idea to submit a pull request for the fix to the library's repository to solve the problem upstream, otherwise the warnings will come back whenever you update to a new release of the library. This will also benefit all the other users of the library.