![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
PID
Dependencies: BLE_API mbed nRF51822
Diff: PID.h
- Revision:
- 0:1f4d5c5491b8
- Child:
- 1:d3e12393b71d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PID.h Mon Oct 24 16:10:48 2016 +0000 @@ -0,0 +1,31 @@ +#ifndef _PID_H_ +#define _PID_H_ + +#include "mbed.h" +#include "math.h" + +#define Te 100 +#define SUPERIOR_MARGIN 100 +#define INFERIOR_MARGIN 0 + +typedef struct +{ + float last_error; + float integral; +}PID_static; + +class PIDClass +{ + public: + PIDClass(int _Kr, int _Ki, int _Kd, int _SetPoint); + + float ComputeCommand(float inputADC); + + private: + int Kr; + int Ki; + int Kd; + int SetPoint; +}; + +#endif \ No newline at end of file