First test programme for the RenBuggy
Dependencies: SevenSegmentDisplay mbed
Fork of Renbed_Buggy_Basics by
Diff: buggy_functions.cpp
- Revision:
- 1:9f6d495cda75
- Parent:
- 0:23373ebd6d3a
- Child:
- 2:10c115fb71e2
diff -r 23373ebd6d3a -r 9f6d495cda75 buggy_functions.cpp --- a/buggy_functions.cpp Thu Apr 21 08:59:08 2016 +0000 +++ b/buggy_functions.cpp Thu Apr 21 13:54:07 2016 +0000 @@ -18,7 +18,10 @@ PwmOut Lmotor(LeftMotorPin); PwmOut Rmotor(RightMotorPin); -//Lmotor = Rmotor = 0; +//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; //DigitalIn is used as a button DigitalIn CurrentButtonState(p7); @@ -43,7 +46,8 @@ extern void forward(float time) //moves forward for (time) seconds { - Lmotor = Rmotor = 1.0; //set the left and right motor to 1.0 (full speed) + Lmotor = 1.0 + trim; + Rmotor = 1.0 - trim; //set the left and right motor to 1.0 (full speed) - the trim offset hold(time); //wait for (time) seconds while the motors are on stop(); //stops the motors }