a
Dependencies: MotorDriver_SU mbed
Fork of tracer by
Revision 1:a9d9cd966fa4, committed 2014-10-27
- Comitter:
- 12f2039e
- Date:
- Mon Oct 27 05:06:11 2014 +0000
- Parent:
- 0:0f3034bec1f8
- Commit message:
- a
Changed in this revision
tracer.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0f3034bec1f8 -r a9d9cd966fa4 tracer.cpp --- a/tracer.cpp Thu Oct 23 06:55:41 2014 +0000 +++ b/tracer.cpp Mon Oct 27 05:06:11 2014 +0000 @@ -8,73 +8,59 @@ MotorDriver_SU motor(MOTOR_DOUBLE); MotorDriver_SU lift(MOTOR_SINGLE); -int f = 2048; -int s = 1000; -int hasegawa = 0; - int main(){ while(1){ //patern1 if(sensor1 == 1 && sensor2 == 1 && sensor3 == 0){ - motor.Drive(0, CW, 1000); //右タイヤ - motor.Drive(1, CW, 2408);//左タイヤ - - hasegawa = 1; + motor.Drive(0, CW, 1700); //右タイヤ + motor.Drive(1, CW, 3200);//左タイヤ } //patern2 else if(sensor1 == 1 && sensor2 == 0 && sensor3 == 1){ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 2048); - - hasegawa = 0;//回転方向判定 + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 3200); } //patern3 else if(sensor1 == 0 && sensor2 == 1 && sensor3 == 1){ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 1000); - - hasegawa = 0; + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 1700); } //patern4 else if(sensor1 == 0 && sensor2 == 0 && sensor3 == 1){ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 1000); - - hasegawa = 0; + motor.Drive(0, CW, 1700); + motor.Drive(1, CW, 3200); } //patern5 else if(sensor1 == 1 && sensor2 == 0 && sensor3 == 0){ - motor.Drive(0, CW, 1000); - motor.Drive(1, CW, 2048); - - hasegawa = 1;//回転方向判定 + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 1700); } //patern6 else if(sensor1 == 0 && sensor2 == 0 && sensor3 == 0){ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 2048); + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 3200); } //patern7 else if(sensor1 == 0 && sensor2 == 1 && sensor3 == 0){ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 2048); + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 3200); } - + /* //patern8 探索回転方向 //ラインの右側に出た場合 反時計回り else if(sensor1 == 1 && sensor2 == 1 && sensor3 == 1 && hasegawa == 0){ motor.Drive(0, CW, 2048); motor.Drive(1, CW, 1000); - } - //ラインの左側に出た場合 時計回り + }*/ + /*//ラインの左側に出た場合 時計回り else if(sensor1 == 1 && sensor2 == 1 && sensor3 == 1 && hasegawa == 1){ motor.Drive(0, CW, 1000); motor.Drive(1, CW, 2048); - } + }*/ else{ - motor.Drive(0, CW, 2048); - motor.Drive(1, CW, 2048); + motor.Drive(0, CW, 3200); + motor.Drive(1, CW, 3200); } }