First test programme for the RenBuggy
Dependencies: SevenSegmentDisplay mbed
Fork of Renbed_Buggy_Basics by
Diff: buggy_functions.cpp
- Revision:
- 2:10c115fb71e2
- Parent:
- 1:9f6d495cda75
diff -r 9f6d495cda75 -r 10c115fb71e2 buggy_functions.cpp --- a/buggy_functions.cpp Thu Apr 21 13:54:07 2016 +0000 +++ b/buggy_functions.cpp Thu Apr 21 13:56:00 2016 +0000 @@ -21,7 +21,7 @@ //Trim is an offset that you can adjust to help the buggy drive straight //Trim = -0.3 is a left trim //Trim = 0.3 is a right trim -float trim = 0.3; +float trim = 0.0; //DigitalIn is used as a button DigitalIn CurrentButtonState(p7); @@ -54,7 +54,7 @@ extern void left(float time) //moves left for (time) seconds { - Rmotor = 1.0; //set the right motor to full speed + Rmotor = 1.0 - trim; //set the right motor to full speed Lmotor = 0.0; //set the left motor to off hold(time); //waits for (time) seconds stop(); //stops the motors @@ -62,7 +62,7 @@ extern void right(float time) //moves right for (time) seconds { - Lmotor = 1.0; //set the left motor to full speed + Lmotor = 1.0 + trim; //set the left motor to full speed Rmotor = 0.0; //set the right motor to off hold(time); //waits for (time) seconds stop(); //stops the motors