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:
- 10:332a4ad5911d
- Parent:
- 9:fd77a619181d
- Child:
- 11:8faa068940f1
--- a/main.cpp Fri Dec 04 06:01:59 2015 +0000 +++ b/main.cpp Sat Dec 05 00:41:23 2015 +0000 @@ -10,29 +10,51 @@ - +float error2; void systick(){ //rotations - float error = rotationError(); - obj.updateErr(error); + error2 = rotationError(); + obj.setKp(1); + obj.setKi(0); + obj.setKd(0); + + obj.updateErr(error2); + + pc.printf("error2: %f \n",error2); + float corr = obj.total(); + + + leftMotor.addToPwm(corr); rightMotor.addToPwm(-corr); - + - pc.printf("%f",error); + // +// myled = 1; // LED is ON +// wait(0.2); // 200 ms +// myled = 0; // LED is OFF +// wait(1.0); // 1 sec + + } + + + int main() { - Systicker.attach_us(&systick,1000); + rightMotor.setPwm(1.0); leftMotor.setPwm(1.0); - pc.printf("Hello!"); + Systicker.attach_us(&systick,1000); + + //loop(); + return 0;