ループのテスト
Dependencies: ATP3012 mbed TB6612FNG HMC6352 US015 getGPS
Diff: main.cpp
- Revision:
- 8:5fe1b4bbd108
- Parent:
- 7:8fab045d2616
- Child:
- 9:9221ef8d36a8
--- a/main.cpp Tue Oct 26 07:19:24 2021 +0000 +++ b/main.cpp Tue Oct 26 08:04:13 2021 +0000 @@ -15,6 +15,7 @@ Serial pc(SERIAL_TX, SERIAL_RX); DigitalIn flight_pin(A0); DigitalOut nichrome(D13); +// int main() { // 変数宣言 @@ -48,20 +49,25 @@ // 移動 catchGPS(&GPS_x, &GPS_y); AngleGet(); - 回転(); - - motor(1) + MotorDriver(4, 0.5); //回転 + wait(); + MotorDriver(1, 0); //回転停止 + + MotorDriver(2, 0.5); // 前進開始 while (True) { if (FrontGet()) { - MotorDriver(1, 0); //停止() + MotorDriver(1, 0); //停止 MotorDriver(4, 0.5); //回転 + wait(); + MotorDriver(1, 0); //回転停止 continue; } else { - 移動(); + MotorDriver(2, 0.5); } - catchGPS(&GPS_x, &GPS_y);; - if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 5) { // CP到着判定 //試験で調整 - break; + catchGPS(&GPS_x, &GPS_y); + if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 5) { // CP到着判定 //試験で調整 + break; + } } } // 行動フロー終了