201803_oshima_jodam_test
Dependencies: BMP180 MPU6050 SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
Diff: main.cpp
- Revision:
- 6:e9004c78b394
- Parent:
- 5:bb9c685fc1fe
- Child:
- 7:852922a4058a
--- a/main.cpp Tue Mar 06 06:56:28 2018 +0000 +++ b/main.cpp Tue Mar 06 07:05:23 2018 +0000 @@ -152,27 +152,27 @@ mpu.getGyro(d); Alt_buff2[i] = get_Alt(pressure, temperature); i++; - if(i == 10){ + if(i == 10){ //10回ごとに中央値計算 Alt_now = median(Alt_buff2, 10); Alt_now = Alt_now - Alt_gnd; t = timer1.read(); fprintf(fp, "%f,%f,%f,%f,%f,%f,%f,%d,%d\r\n",Alt_now,a[0],a[1],a[2],d[0],d[1],d[2],t,Cnt_para); if(Alt_now > Max_Alt) Max_Alt = Alt_now; i = 0; - if(tf_para == true){ + if(tf_para == true){ //パラ開くまでは頂点判定 Alt_buff[Cnt_buff+1] = Alt_now; if(Alt_buff[Cnt_buff]>Alt_buff[Cnt_buff+1]) Cnt_para++; //直前の値より小さければカウント+1 // twe.printf("Cnt_para:%d\r\n", Cnt_para); Cnt_buff++; - if(Cnt_para == 10 || t > TIMER){ - kaihou.detach(); - fprintf(fp,"OPEN!\r\n"); + if(Cnt_para == 10 || t > TIMER){ //頂点!!! + kaihou.detach(); //SD閉じる前にサーボ動かす前にTicker止める + fprintf(fp,"OPEN!\r\n"); fclose(fp); _para(UNLOCK); tf_para = false; timer1.stop(); - twe.printf("PARA_OPEN\r\n"); - ochiru.attach(_recovery,0.1); + twe.printf("PARA_OPEN\r\n"); + ochiru.attach(_recovery,0.1); //パラメータ保存のためのやつ } }