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:
- openg
- Date:
- 2016-03-16
- Revision:
- 0:f641e7f8973f
- Child:
- 1:f2a8a330983b
File content as of revision 0:f641e7f8973f:
#include "mbed.h" #include "PID.h" float Kp = 30.0; float Ki = 0.0; float Kd = 0.0; float interval = 0.1; //in seconds PID controller(Kp, Ki, Kd, interval); float currentVelocity; PwmOut co(p26); Ticker executeController; void control() { controller.setProcessValue(currentVelocity); outputPWM = controller.compute(); } int main() { controller.setInputLimits(0.0, 6.0); //max input speeds in m/s controller.setOutputLimits(0.0, 1.0); //PWM outputs from 0% to 100% controller.setSetPoint(3.0); //reference velocity is 3.0 m/s controller.setBias(0.0); //no bias for controller to output controller.setMode(1); //AUTO mode executeController.attach(&control, interval); }