![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
修正済みby皆川
Dependencies: mbed Servo cansat_integrated_2 BMP180
Dependents: cansat_integrated_2
Diff: main.cpp
- Revision:
- 13:c482c4d7a585
- Parent:
- 11:8d21db3e64f5
diff -r 79946f960100 -r c482c4d7a585 main.cpp --- a/main.cpp Fri Nov 05 15:41:24 2021 +0000 +++ b/main.cpp Sun Dec 19 02:42:53 2021 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" -#include "direction.h" #include "BMP180.h" #include "calculate.h" +#include "Movement.h" #define PIN_SDA D4 #define PIN_SCL D5 @@ -35,25 +35,25 @@ while(x<10){ if(bmp180.ReadData(&dt,&dp)){ h = calculate_h(dp0,dp,dt); - if(h >= 10){ + if(h >= 15){ x = x + 1; } wait(1); } } + wait(10); + + //離陸判定後、10秒以上高度2m以下にいた場合着地判定 + while(y<10){ + if(bmp180.ReadData(&dt,&dp)){ + h = calculate_h(dp0,dp,dt); + if(h <= 6){ + y = y + 1; + } + wait(1); + } + } - wait(10); - - //離陸判定後、10秒以上高度2m以下にいた場合着地判定 - while(y<10){ - if(bmp180.ReadData(&dt,&dp)){ - h = calculate_h(dp0,dp,dt); - if(h <= 2){ - y = y + 1; - } - wait(1); - } - } //30秒待機 wait(30); @@ -62,9 +62,30 @@ wait(10); Nichrome=0; - //中間地点を経由してゴール地点まで移動 - direction hokou; - hokou.walk(); + //前進して段差を上る、15m前進 + Movement idou; + idou.move_backward(); + wait(180); + + //右に45°方向転換して前進 + idou.turn_right(45); + idou.move_backward(); + wait(5); + + //左に45°方向転換して前進 + idou.turn_left(45); + idou.move_backward(); + wait(5); + + //右に90°方向転換して前進 + idou.turn_right(90); + idou.move_backward(); + wait(5); + + //左に90°方向転換して前進 + idou.turn_left(90); + idou.move_backward(); + wait(5); return 0;