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.
Dependencies: mbed MODSERIAL telemetry-master
Fork of coolcarsuperfast by
Diff: main.cpp
- Revision:
- 13:5be515371946
- Parent:
- 12:48b76450c4b4
- Child:
- 14:888495814f3c
--- a/main.cpp Thu Apr 09 05:07:19 2015 +0000
+++ b/main.cpp Thu Apr 09 05:48:35 2015 +0000
@@ -84,8 +84,9 @@
int numInterrupts = 0;
-float pulsewidth = 0.2f;
-
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~PWM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
+float pulsewidth = 0.15f;
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Hardware periods
float motorPeriod = .0025;
float servoPeriod = .0025;
@@ -443,16 +444,16 @@
}
//Change speed when turning at different angles
- /*if(approxPos > 0 && approxPos <= 45){
- motor1.pulsewidth(motorPeriod*(pulsewidth/2));
- motor2.pulsewidth(motorPeriod*(pulsewidth/2));
+ if(approxPos > 0 && approxPos <= 45){
+ motor1.pulsewidth(motorPeriod*(pulsewidth*0.66f));
+ motor2.pulsewidth(motorPeriod*(pulsewidth*0.66f));
} else if (approxPos > 45 && approxPos <= 95){
motor1.pulsewidth(motorPeriod*pulsewidth);
motor2.pulsewidth(motorPeriod*pulsewidth);
} else {
- motor1.pulsewidth(motorPeriod*(pulsewidth/2));
- motor2.pulsewidth(motorPeriod*(pulsewidth/2));
- }*/
+ motor1.pulsewidth(motorPeriod*(pulsewidth*0.66f));
+ motor2.pulsewidth(motorPeriod*(pulsewidth*0.66f));
+ }
servo.pulsewidth(currDir);
