Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FATFileSystem
Fork of FTE-06 by
Diff: main.cpp
- Revision:
- 18:f6ecd5ea145f
- Parent:
- 15:792eb5103e9e
--- a/main.cpp Sun Jul 09 09:30:54 2017 +0000
+++ b/main.cpp Sat Aug 05 12:36:29 2017 +0000
@@ -27,6 +27,7 @@
#define time_between_para_opening_ms 4000//パラシュート展開用の電熱線の加熱時間(msec)
#define conv2Gravity 1./(32768./Acc_range)//加速度センサの値の単位をGに変換
#define AT24C1024_address 0x50
+#define eeprom_byte_size 100000
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
@@ -105,7 +106,7 @@
} while (seed > 1000);//0~999のunsigned_int型に変換
srand(seed);
result_num = rand();
- sprintf(filename, "result_%d.dat", result_num);
+ sprintf(filename, "result_%d.csv", result_num);
mkdir("/sd/mydir", 0777);
}
@@ -129,9 +130,9 @@
/*SDカードに書き込み*/
- FILE *fp = fopen("/sd/mydir/filename", "w");
+ FILE *fp = fopen("/sd/mydir/data.csv", "a");
if (fp == NULL)error("Could not open SD Card for write\n");
- fprintf(fp, "%f %f %f %f %f %f %f %f %f %f %f %f %f %f\n", time, temp, pres, acc[0], acc[1], acc[2], gyro[0], gyro[1], gyro[2], latitude, longitude);
+ fprintf(fp, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n", val, temp, pres, acc[0], acc[1], acc[2], gyro[0], gyro[1], gyro[2], mag[0], mag[1], mag[2], latitude, longitude);
fclose(fp);
}
@@ -158,7 +159,13 @@
}
void delete_eeprom() { //eepromの中身を全消去
-
+ char *del;
+ char emp='0';//eepromの初期化は"0"
+ eeprom.nbyte_read(0,del,1);
+ for(int32_t n=0;del[0]!='\0'&&n<eeprom_byte_size;n++){//終端文字か指定バイトの数まで初期化
+ eeprom.byte_write(n,emp);
+ eeprom.nbyte_read(n+1,del,1);
+ }
}

