I'm trying to read from a BT serial port and write what I receive to a txt file, the code works fine for short strings (Ie: 1234) but cuts off with anything long (ie 12345676890 becomes 12345678) Here is the relevant part of my code:
void WriteConfigFile(String ConfigFile) {
char receivedChar;
Serial2.println("Waiting for New File");
while (Serial2.available() < 1) { //wait for serial data and save to data file
// wait
}
Serial2.println("Data Recived");
SD.remove(ConfigFile.c_str()); //Remove Old File
myFile = SD.open(ConfigFile.c_str(), FILE_WRITE);
while (Serial2.available()) {
receivedChar = Serial2.read();
myFile.print(receivedChar);
Serial2.print(receivedChar);
}
myFile.close();
Serial2.println("New Config Writen");
}
any ideas?