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: PID/PID.h
- Revision:
- 0:37f0c1e8fa66
- Child:
- 1:60882db03b0f
diff -r 000000000000 -r 37f0c1e8fa66 PID/PID.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PID/PID.h Tue Sep 08 13:38:10 2015 +0000
@@ -0,0 +1,30 @@
+// by MaEtUgR
+
+#ifndef PID_H
+#define PID_H
+
+#include "mbed.h"
+
+class PID {
+ public:
+ PID(float P, float I, float D, float Integral_Max);
+ float compute(float SetPoint, float ProcessValue);
+ void setIntegrate(bool Integrate);
+ void setPID(float P, float I, float D);
+
+ float Value;
+
+ private:
+ float P, I, D; // PID Values and limits
+
+ Timer dtTimer; // Timer to measure time between every compute
+ float LastTime; // Time when last loop was
+
+ float Integral; // the sum of all errors (constaind so it doesn't get infinite)
+ float Integral_Max; // maximum that the sum of all errors can get (not important: last error not counted)
+ bool Integrate; // if the integral is used / the controller is in use
+
+ float PreviousError; // the Error of the last computation to get derivative
+};
+
+#endif
\ No newline at end of file