Running a flight computer program on Arduino IDE, which prints readings from an altimeter and an accelerometer to both Serial and an SD card. I've attempted to run the program for as long as possible, stationary, just to see if it will last the duration of a flight; but the program always stops running after ~66-67 seconds. I thought it might have been an issue with the sensors, so I made a demo code that just prints "hello" to the SD card, but had the same issue—always stops around 66 seconds. There aren't any error messages—the Serial print lines just stop. Has anyone experienced this/does anyone know why this might be happening?
Hardware: Arduino MKR WAN 1310, Adafruit LSM6DSO32, Adafruit BMP390, and Adafruit SPI Flash SD Card (4GB).
Demo code:
#include <SD.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_SensorLab.h>
const int sdCS = 6;
File sdFile;
void setup() {
Wire.begin();
Serial.begin(115200);
while (!Serial) {
delay(10);
}
Serial.println("Serial begin");
Serial.print("Initializing SD card...");
if (!SD.begin(sdCS)) {
Serial.println("SD initialization failed");
} else {
Serial.println("SD initialization successful");
}
sdFile = SD.open("test01.txt", FILE_WRITE);
if (sdFile) {
Serial.print("Writing to file...");
sdFile.println("Initial write.");
sdFile.close();
Serial.println("Writing done.");
} else {
Serial.println("Error opening file for writing.");
while(1);
}
}
void loop() {
delay(100);
sdFile = SD.open("test05.txt", FILE_WRITE);
if (sdFile) {
sdFile.println("hello");
sdFile.flush();
Serial.println("Wrote to file 5.");
} else {
Serial.println("Error writing to file.");
}
Serial.println("hello");
// put your main code here, to run repeatedly:
}
Thanks in advance