-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Got my qwiic openlog up and running, and it writes to the SD card. I've run through a few of the examples, and noticed a bug - often, the datalog file will have incomplete lines. For example, if the command in the sketch is:
myLog.println("This is recorded to the default log file");
...then the corresponding line in the log file on the SD card is:
This is
Sometimes the complete line is printed without issue, but pretty often it will cut off lines in random spots, with no apparent repeatability. For example, after the log mentioned before, I deleted everything but the config file from the SD card and tried again, and this was the full output:
Run OpenLog N
This i
This i
If you want to write to a
I am using a slightly modified Example3_CreateFile sketch - added some delays to make it easier to catch the Serial Monitor outputs, but the same issue arises regardless. Also using "SerialUSB" instead of "Serial" because I'm using a SparkFun SAMD21 Pro RF board.
I've tried two different SAMD21 boards and two different qwiic OpenLog boards with no difference - randomly cut off lines.
Here's my sketch:
#include <Wire.h>
#include "SparkFun_Qwiic_OpenLog_Arduino_Library.h"
OpenLog myLog; //Create instance
int ledPin = 13; //Status LED connected to digital pin 13
void setup()
{
delay(10000);
pinMode(ledPin, OUTPUT);
delay(1000);
Wire.begin();
delay(1000);
myLog.begin(); //Open connection to OpenLog (no pun intended)
delay(1000);
SerialUSB.begin(9600); //9600bps is used for debug statements
delay(1000);
SerialUSB.println("Run OpenLog New File Test"); //Goes to terminal
delay(1000);
myLog.println("Run OpenLog New File Test"); //Goes to the default LOG#.txt file
delay(1000);
myLog.println("This is recorded to the default log file");
delay(1000);
myLog.create("NewFile.txt");
delay(1000);
myLog.println("This is also recorded to the default log file. But a new file has been created");
delay(1000);
myLog.println("If you want to write to a file use appendFile in example 2");
delay(1000);
SerialUSB.println("Done!");
}
void loop()
{
//Blink the Status LED because we're done!
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(1000);
}