If you are asking a question, please follow this template:
- My goal is: Logging IMU data in SD card in csv
- My actions are: I am using https://github.com/nliviu/sdlib library
- The result I see is:
- My expectation & question is: It get This reboot after some no. of files craeted or logged.
code as follows:
for (int i = 1; i <1000; i++) {
snprintf(filename, sizeof(filename), filename_format, i);
if (!imu) return;
FILE* f = fopen(filename, "w");
fprintf(f,"Ax,Ay,Az,Gx,Gy,Gz,Mx,My,Mz\n ");
for (int x = 0; x <50; x++) {
mgos_imu_accelerometer_get(imu, &ax, &ay, &az);
mgos_imu_gyroscope_get(imu, &gx, &gy, &gz);
mgos_imu_magnetometer_get(imu, &mx, &my, &mz);
fprintf(f,"X=%.2f, Y=%.2f, Z=%.2f, X=%.2f, Y=%.2f, Z=%.2f, X=%.2f, Y=%.2f, Z=%.2f, \n",
ax, ay, az, gx, gy, gz, mx, my, mz);
} fclose(f);
if (f == NULL)
{
LOG(LL_INFO, ("%s","Writing Failed"));
return;
}
}