![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
take 1
Dependencies: ContinuousServo Tach mbed
Diff: main.cpp
- Revision:
- 1:ed49c46d8998
- Parent:
- 0:b059e65bf362
- Child:
- 2:bf1da9059e82
--- a/main.cpp Thu Apr 19 15:22:15 2018 +0000 +++ b/main.cpp Thu Apr 19 15:36:11 2018 +0000 @@ -22,8 +22,10 @@ float PIpwmR(float desired_speed,float speed); int main() { + wait(5); //go straight while(1){ + speedL = tLeft.getSpeed(); speedR = tRight.getSpeed(); l = PIpwmL(0.5, speedL); @@ -52,6 +54,6 @@ float sampling_per = 0.05; float errorR = desired_speed - speed; integral_errorR += (errorR*sampling_per); - float right = (0.07*integral_errorR) + (0.06*errorR) + 0.31; + float right = (0.07*integral_errorR) + (0.06*errorR) + 0.3; return right; } \ No newline at end of file