![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2017年3月,伊豆大島共同打上実験 CORE_缶ロケチーム電装
Dependencies: MPU6050 MS5607 mbed SDFileSystem
Diff: main.cpp
- Revision:
- 2:b6eb08d059cc
- Parent:
- 1:ec75f428c6b3
- Child:
- 3:9cd74af355cc
diff -r ec75f428c6b3 -r b6eb08d059cc main.cpp --- a/main.cpp Sat Feb 18 17:02:59 2017 +0000 +++ b/main.cpp Sat Feb 18 17:32:44 2017 +0000 @@ -3,7 +3,7 @@ #include "MPU6050.h" #include "SDFileSystem.h" -#define RATE 20 +#define RATE 10 MS5607I2C ms5607(p9, p10, false); MPU6050 mpu(p9,p10); @@ -19,11 +19,13 @@ bool mode = 0; float pressure[2][RATE],temperature[2][RATE]; float acc[2][RATE][3],gyro[2][RATE][3]; -float t[2][RATE]; +float t[2][RATE],alt,alt_max,alt_launch; FILE *fp; void _Launch(){ + alt_launch = alt; myled = 1; + } void _measure(){ t[mode][cnt] = timer.read(); @@ -31,8 +33,7 @@ temperature[mode][cnt] = ms5607.getTemperature(); mpu.getAccelero(&acc[mode][cnt][0]); mpu.getGyro(&gyro[mode][cnt][0]); -// pc.printf("%f,%f,%f\t",pressure[cnt],temperature[cnt], altitude[cnt]); -// pc.printf("%f,%f,%f,%f,%f,%f\r\n",acc[cnt][0],acc[cnt][1],acc[cnt][2],gyro[cnt][0],gyro[cnt][1],gyro[cnt][2]); + alt = ms5607.getAltitude(); fprintf(fp, "%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n", t[mode][cnt],pressure[mode][cnt],temperature[mode][cnt],acc[mode][cnt][0], acc[mode][cnt][1],acc[mode][cnt][2],gyro[mode][cnt][0],gyro[mode][cnt][1],gyro[mode][cnt][2] @@ -40,7 +41,7 @@ cnt++; if(cnt==RATE){ fclose(fp); - fp = fopen("/sd/sdtest.txt", "a"); + fp = fopen("/sd/log.txt", "a"); mode =! mode; cnt = 0; } @@ -48,7 +49,7 @@ int main() { timer.start(); - fp = fopen("/sd/sdtest.txt", "w"); + fp = fopen("/sd/log.txt", "w"); fprintf(fp, "pressure,temperature,ax,ay,az,gx,gy,gz\r\n"); myled = 0; loop_measure.attach(&_measure,1.0/RATE);