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
Diff: main.cpp
- Revision:
- 3:5d0c4b13f4e8
- Parent:
- 2:e2b803e3bcbc
- Child:
- 4:1354e56c7dd3
--- a/main.cpp	Fri Nov 08 16:16:43 2019 +0000
+++ b/main.cpp	Fri Nov 08 19:48:16 2019 +0000
@@ -2,6 +2,7 @@
 #include "mbed.h"       //mbed
 #include "getGPS.h"         //GPS
 #include "math.h"         //GPS
+#include "TB6612.h"      //motorDriver
 #include "XBee.h"        //XBee
 #include <SoftwareSerial.h>   //カメラ
 #include <SD.h>//SDカード
@@ -20,8 +21,8 @@
 DigitalOut led(LED1);     
 Serial pc(USBTX, USBRX); // tx, rx  焦電センサ↑
 Serial pc (p9);     //カメラ
-//Motor motor1(p22, p16, p17, 1); // pwm, fwd, rev, can brake     モーター
-//Motor motor2(p22, p19, p20, 1); // pwm, fwd, rev, can brake
+TB6612 left(p25,p17,p16);
+TB6612 right(p26,p19,p18);
 
 int main() {            //FET
     FET = 0;
@@ -116,38 +117,17 @@
         return 0;          //注意!void()に変えること.このままだとここで終わる
      }
       
-
-void motorForwardR(void);
-void motorStopR(void);
-void motorReverseR(void);
-void motorForwardL(void);
-void motorStopL(void);
-void motorReverseL(void);
-LocalFileSystem local(“local”);               // Create the local filesystem under the name “local”   データ保存
-float culculate_distance_3(float a,float b);
-
-   motorStopR();
-   motorStopL();
-   wait(20);     //確認用//デフォ20秒
-//    FILE *fp = fopen(“/local/gps.txt”, “w”);  // Open “gps.txt” on the local file system for writing
-         motorSpeedR.period_ms(4);              //モーター調節
-         motorSpeedR = 0.655;
-         motorSpeedL.period_ms(4);              //モーター調節
-motorSpeedL = 0.755;
- motorForwardL(); //車体を時計回りに3秒回転
-   motorReverseR();
-   wait(1.6);
-   motorStopR();
-   motorStopL();
-   wait(1);
-   motorReverseL(); //車体を反時計回りに3秒回転
-   motorForwardR();
-   wait(1.6);
-   motorStopR();
-   motorStopL();
-   wait(1);
-   printf(“compass carriblation\r\n”); //キャリブレーション終了
-//float mcn1,mcn2;
+int main() {
+    while(1) {
+        left = 100; //左モーター100%
+        right = 100;//右モーター100%
+        wait(1.0);
+        left = 30;//左30%
+        right = 30;//右30%
+        wait(1.0);
+        printf("OK");
+    }
+}
 
 if(distance<2000){
     motorStopR();