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:
- 1:f6d4f374b130
- Parent:
- 0:5a1b52164bbe
- Child:
- 3:74d0faefdd78
diff -r 5a1b52164bbe -r f6d4f374b130 main.cpp
--- a/main.cpp Wed Oct 13 12:44:09 2021 +0000
+++ b/main.cpp Sat Oct 23 03:37:21 2021 +0000
@@ -3,62 +3,10 @@
#include "ATP3011.h"
#include "getGPS.h"
#include "HMC6352.h"
-
-TB6612 motor_a(D10,D6,D7); //モータA制御用(pwma,ain1,ain2)
-TB6612 motor_b(D11,D8,D9); //モータB制御用(pwmb,bin1,bin2)
-Serial pc(USBTX,USBRX); //USBシリアル通信用
-GPS gps(D1, D0);
-HMC6352 compass(D4, D5);
+#include "Avoid.h"
+#include "FrontGet.h"
+#include "AngleGet.h"
-int motor(char m) {
- float motor_speed; //モータスピード情報格納用
- while(1) {
- m = pc.getc(); //キーボード入力情報取得
- motor_speed=0.5; //モータスピード(低速運転させるため2分の1の値とする。)
- switch(m)
- {
- case '1': motor_a=motor_speed; //モータA正転
- break;
- case '2': motor_a=0; //モータAブレーキ
- break;
- case '3': motor_a=-motor_speed; //モータA逆転
- break;
- case '7': motor_b=motor_speed; //モータB正転
- break;
- case '8': motor_b=0; //モータBブレーキ
- break;
- case '9': motor_b=-motor_speed; //モータB正転
- break;
- default : motor_a=0;
- motor_b=0; //両方モータブレーキ
- break;
- }
- }
-}
-
-
-
-int GPS()
-{
- /* 1秒ごとに現在地を取得してターミナル出力 */
- while(1) {
- if(gps.getgps()) //現在地取得
- pc.printf("(%lf, %lf)\r\n", gps.latitude, gps.longitude);//緯度と経度を出力
-
- else
- pc.printf("No data\r\n");//データ取得に失敗した場合
-
- wait(1);
- }
-
- return 0;
-}
-
-int compass()
-{
- compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);
-
-}
int main() {
// 変数宣言