おためしらいぶらり Q-rover-Kaiを50行以内で動かすという強い気持ち 使用非推奨 動作未確認 単純なPWM動作のライブラリ化実験用
Fork of QMotor by
Diff: QMotor.cpp
- Revision:
- 1:b80cd8133481
- Parent:
- 0:48d84c228105
diff -r 48d84c228105 -r b80cd8133481 QMotor.cpp --- 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;