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.
Diff: main.cpp
- Revision:
- 3:e14a4ea167ca
- Parent:
- 2:5eb97170c199
- Child:
- 4:18f5328ff5a3
--- a/main.cpp Wed Mar 25 16:20:52 2015 +0000 +++ b/main.cpp Wed Mar 25 16:42:21 2015 +0000 @@ -79,7 +79,7 @@ bool turn_left=false; bool turn_right=false; - float bullshit_offset = .08; + float bullshit_offset = .074; // major loop while(1) { @@ -218,7 +218,10 @@ { //left_counter += (128-black_center_value); //left_counter+=20; - left_counter=-0.4; + if(left_counter<-0.38) + left_counter=-0.5; + else + left_counter= -0.4; turn_left=true; turn_right=false; @@ -240,7 +243,10 @@ //right_counter += black_center_value; //right_counter +=20; - right_counter =.4; + if (right_counter >.38) + right_counter =.5; + else + right_counter =.4; turn_left=false; turn_right=true; @@ -289,7 +295,7 @@ if (left_counter > (0+ bullshit_offset)) turn_left = false; - TFC_SetMotorPWM(current_left_motor_speed+(.2*left_counter), current_right_motor_speed+(.2*left_counter)); + TFC_SetMotorPWM(current_left_motor_speed+(.1*left_counter), current_right_motor_speed+(.3*left_counter)); //left_counter -= 1; //if (left_counter < 10) // turn_left =false; @@ -304,7 +310,7 @@ if (right_counter < (0+ bullshit_offset)) turn_right = false; - TFC_SetMotorPWM(current_left_motor_speed-(.2*right_counter), current_right_motor_speed-(.2*right_counter)); + TFC_SetMotorPWM(current_left_motor_speed-(.3*right_counter), current_right_motor_speed-(.1*right_counter)); //right_counter -= 1; // if (right_counter < 10) // turn_right =false;