Hi,
I have a code for SD card interface from the internet and I realised that the SD card is not working properly. So when I run the code The file gets created and the numbers are sometimes there sometime not there etc. I have only seen one number printed to file at max
#include <SPI.h>
#include <Seeed_FS.h>
#include "SD/Seeed_SD.h"
File myFile;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial) {
}
Serial.print("Initializing SD card...");
if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
//myFile = SD.open("test.txt", FILE_WRITE);
}
void loop() {
// put your main code here, to run repeatedly:
for (int i=0; i<256; i++){
myFile = SD.open("test2.txt", FILE_WRITE);
myFile.println("Write num");
myFile.println(i);
myFile.close();
delay(100);
}
}