I want to read the data from the text file and want to show it on the Arduino Serial Monitor. SO Below is the code which I extracted from
#include<SD.h>
File myfile;
void setup(){
Serial.begin(9600);
Serial.print("Initializing card...");
// declare default CS pin as OUTPUT
pinMode(53, OUTPUT);
if (!SD.begin(4)) {
Serial.println("initialization of the SD card failed!");
return;
}
Serial.println("initialization of the SDcard is done.");
// open the text file for reading:
myfile = SD.open("help2.txt");
if (myfile){
Serial.println("help2.txt:");
// read all the text written on the file
while (myfile.available()){
Serial.println(myfile.read());
}
// close the file:
myfile.close();
}
else {
// if the file didn't open, report an error:
Serial.println("error opening the text file!");
}
}
void loop(){
}
But when the code is compiled and uploaded on the Arduino, only "Initializing card..." is printing on the serial monitor. I want to get whole data which is present in the text file on the serial monitor.