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.
main.cpp
- Committer:
- jasonliujc
- Date:
- 2015-12-05
- Revision:
- 11:8faa068940f1
- Parent:
- 10:332a4ad5911d
File content as of revision 11:8faa068940f1:
#include "mbed.h" #include "pid.h" Ticker Systicker; //////setting the errors for PID ctrl obj; float error2; void systick(){ //rotations 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); // // myled = 1; // LED is ON // wait(0.2); // 200 ms // myled = 0; // LED is OFF // wait(1.0); // 1 sec } int main() { rightMotor.setPwm(1.0); leftMotor.setPwm(1.0); Systicker.attach_us(&systick,1000); //loop(); // pc.printf("test\n"); return 0; } /// add something