We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi I need to read data from serial port then write all to usb flash drive my data send from pc around 1000 line like below
"0001: 2021-03-09 15:31:56 G001 3333 mv 127.36\r\n" | | "1000: 2021-03-09 15:31:56 G001 3333 mv 127.36\r\n"
but It isn't written at all line , it is written around 5-10 line only. this is my code , could you advise me ? **so sorry about my english.
SoftwareSerial mySerial(7, 6);// CH376S String inputString = ""; bool stringComplete = false; //-------- setup ---------// void setup() { Serial.begin(9600); mySerial.begin(115200); } //-------- Serial monitoring ---------// void serialEvent() { while (Serial.available()) { char inChar = (char)Serial.read(); inputString += inChar; if (inChar == '\n') { stringComplete = true; } } } //------- void loop ---------// void loop() { if(stringComplete){ // prepare string to char int str_len = inputString.length() + 1; char char_array[str_len]; inputString.toCharArray(char_array, str_len); flashDrive.setFileName("REPORT.TXT"); //set the file name if(flashDrive.openFile() == ANSW_USB_INT_SUCCESS){ //open the file flashDrive.moveCursor(CURSOREND); //if the file exist, move the "virtual" cursor at end of the file } // write to wire flashDrive.writeFile(char_array, strlen(char_array)); flashDrive.closeFile(); // clear data inputString ="; stringComplete = false; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi
I need to read data from serial port then write all to usb flash drive
my data send from pc around 1000 line like below
but It isn't written at all line , it is written around 5-10 line only.
this is my code , could you advise me ?
**so sorry about my english.
The text was updated successfully, but these errors were encountered: