When I run this code in another pc , worked well . But same code occurs this error :
C:\Users\berkc\Desktop\sketch_dec16a\sketch_dec16a.ino: In function ‘void mode_learn()’:
C:\Users\berkc\Desktop\sketch_dec16a\sketch_dec16a.ino:36:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
tmrpcm.play(“colorRed.wav”); //Play music file
^
C:\Users\berkc\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function ‘byte TMRpcm::metaInfo(boolean, char*, char*, byte)’:
C:\Users\berkc\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1381:18: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
char* datStr = “LIST”;
And the code is :
#include <SD.h> // need to include the SD library
#define SD_ChipSelectPin 53 //using digital pin 4 on arduino nano 328, can use other pins
#include <Button.h>
#include <TMRpcm.h> // also need to include this library...
#include <SPI.h>
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int counter=0;
TMRpcm tmrpcm; // create an object for use in this sketch
void setup(){
pinMode(9,INPUT);
pinMode(10,INPUT);
tmrpcm.speakerPin = 46; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
tmrpcm.setVolume(6);
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
Serial.println("SD fail");
return; // don't do anything more if not
}
}
void mode_quiz(){
if(buttonState1 == HIGH && tmrpcm.isPlaying()== false){
tmrpcm.play("test.wav"); //Play music file
Serial.println("button 2 pressed");
}
}
void mode_learn(){
if(buttonState1 == HIGH && tmrpcm.isPlaying()== false){
tmrpcm.play("colorRed.wav"); //Play music file
Serial.println("button 1 pressed");
}
}
void loop(){
buttonState1 = digitalRead(9);
buttonState2 = digitalRead(10);
buttonState3 = digitalRead(11);
if(buttonState2 == HIGH){
counter++;
}
if(counter%2==0){
mode_quiz();
Serial.println("mode quız");
delay(300);
}
else{
mode_learn();
Serial.println("mode learn");
delay(300);
}
}
Is there anyone can help me ?