Test code 29-10-2019
Dependencies: mbed RC_Servo VMA306 PID CNY70 CMPS03 GP2A Pixy
Diff: main.cpp
- Revision:
- 14:899c6d29c0a8
- Parent:
- 13:f81c8451d601
- Child:
- 15:a0a88aeb4fe1
diff -r f81c8451d601 -r 899c6d29c0a8 main.cpp --- a/main.cpp Fri Oct 25 13:24:47 2019 +0000 +++ b/main.cpp Fri Oct 25 13:53:17 2019 +0000 @@ -49,7 +49,7 @@ motor.setProportionnalValue(2.0); motor.setintegralValue(0.4); motor.setDerivativeValue(1.0); - double speed_L = -50, speed_R = -50; + double speed_L = -200, speed_R = -200; while (1) { motor.getPosition(&x, &y, &theta); @@ -62,7 +62,7 @@ break; case TURN_RIGHT : - motor.setSpeed(-speed_L,speed_R);// turn right + motor.setSpeed(-speed_L/10.0,speed_R/10.0);// turn right if (pixy.checkNewImage()) { pixy.detectedObject(&numberOfObjects,&dummy); @@ -98,11 +98,11 @@ file=pixy.getNMBloc(); pc.printf("\r x = %d", file.x); if (file.x >165){ - motor.setSpeed(-speed_L,speed_R);// turn right + motor.setSpeed(-speed_L/10.0,speed_R/10.0);// turn right pc.printf(" - Turning right"); } else if (file.x <155){ - motor.setSpeed(speed_L,-speed_R);// turn left + motor.setSpeed(speed_L/10.0,-speed_R/10.0);// turn left pc.printf(" - Turning left"); } else {