おためしらいぶらり Q-rover-Kaiを50行以内で動かすという強い気持ち 使用非推奨 動作未確認 単純なPWM動作のライブラリ化実験用

Fork of QMotor by Kotaro Yamamoto

Files at this revision

API Documentation at this revision

Comitter:
KOTAROYamamoto
Date:
Wed Dec 06 23:07:23 2017 +0000
Parent:
0:48d84c228105
Commit message:
?????????????

Changed in this revision

QMotor.cpp Show annotated file Show diff for this revision Revisions of this file
QMotor.h Show annotated file Show diff for this revision Revisions of this file
--- a/QMotor.cpp	Wed Dec 06 07:07:32 2017 +0000
+++ b/QMotor.cpp	Wed Dec 06 23:07:23 2017 +0000
@@ -6,7 +6,8 @@
     _R2=0.0;//R2を初期化
     _L1=0.0;//L1を初期化
     _L2=0.0;//L2を初期化
-
+    float san1;
+    float san2;
 }
 
 void QMotor::Front1(){                   //直進部
@@ -44,14 +45,14 @@
     _L1=0.0;
     _L2=0.0;
 }
-void QMotor::Right1(float an,float san){          //第一while関数右折部
+void QMotor::Right1(float an){          //第一while関数右折部
     //sdprint(" an=");
     //sdprint(an);
     //sdprint(" R1 ");
     //xbee.printf("COMMAND:Right1\n");
     _R1=1.0;
     _R2=0.0;
-    wait(-an*san);
+    wait(-an*san1);
         
     _R1=1.0;
     _R2=1.0;
@@ -60,7 +61,7 @@
     _R2=0.0;
   }
   
-  void QMotor::Right2(float an,float san){          //第二while関数右折部
+  void QMotor::Right2(float an){          //第二while関数右折部
     //sdprint(" an=");
     //sdprint(an);
     //sdprint(" R2 ");
@@ -68,7 +69,7 @@
     //analogWrite(5,76.5);//Lモーターを30%出力で回転
     _R1=1.0;
     _R2=0.0;
-    wait(-an*san);
+    wait(-an*san2);
         
     _R1=1.0;
     _R2=1.0;
@@ -78,14 +79,14 @@
   }
   
   
-  void QMotor::Left1(float an,float san){           //第一while関数左折部
+  void QMotor::Left1(float an){           //第一while関数左折部
     //sdprint(" an=");
     //sdprint(an);
     //sdprint(" L1 ");
     //xbee.printf("COMMAND:Left1\n");
     _L1=1.0;
     _L2=0.0;
-    wait(an*san);
+    wait(an*san1);
         
     _L1=1.0;
     _L2=1.0;
@@ -94,7 +95,7 @@
     _L2=0.0;
   }
 
-  void QMotor::Left2(float an,float san){           //第二while関数左折部
+  void QMotor::Left2(float an){           //第二while関数左折部
     //sdprint(" an=");
     //sdprint(an);
     //sdprint(" L2 ");
@@ -102,7 +103,7 @@
     //analogWrite(6,76.5);//Rモーターを30%出力で回転
     _L1=1.0;
     _L2=0.0;
-    wait(an*san);
+    wait(an*san2);
         
     _L1=1.0;
     _L2=1.0;
--- a/QMotor.h	Wed Dec 06 07:07:32 2017 +0000
+++ b/QMotor.h	Wed Dec 06 23:07:23 2017 +0000
@@ -14,10 +14,10 @@
         
         void Front1();
         void Front2();
-        void Right1(float an,float san);
-        void Right2(float an,float san);
-        void Left1(float an,float san);
-        void Left2(float an,float san);
+        void Right1(float an);
+        void Right2(float an);
+        void Left1(float an);
+        void Left2(float an);
         void Reverse();
         void Stack();
         void Fred();
@@ -27,6 +27,8 @@
     PwmOut _R2;
     PwmOut _L1;
     PwmOut _L2;
+    float san1;
+    float san2;
 };
 void Front1();
 void Front2();