Guys i have stuck.
At void setup() i use SD.begin(4) to read a text file from Sd.
When the reading of Sd completes i want to play music from Sd card (SdPlay.setSDCSPin(4) but i have already set pin(4) for reading the text.
Anyone knows how to reset the pin4 and use it again for listening music from sd?
At void setup() i use SD.begin(4) to read a text file from Sd.
When the reading of Sd completes i want to play music from Sd card (SdPlay.setSDCSPin(4) but i have already set pin(4) for reading the text.
Anyone knows how to reset the pin4 and use it again for listening music from sd?
C:
void setup() {
Serial.begin(9600);
//-------------------------------------------------------------------
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
myFile.close();
Serial.println("done.");
} else {
Serial.println("error opening test.txt");
}
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
//----------------------------------------------------------------------------------------------------------
SdPlay.setSDCSPin(4); //------>Here problem caused
}
Last edited by a moderator: