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 HMC6352 US015 TB6612FNG2 getGPS ATP3011
Diff: main.cpp
- Revision:
- 8:5fe1b4bbd108
- Parent:
- 7:8fab045d2616
- Child:
- 9:9221ef8d36a8
diff -r 8fab045d2616 -r 5fe1b4bbd108 main.cpp
--- 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;
+ }
}
}
// 行動フロー終了