This is a copy of the Reference Standard PID controller ala controlguru.com

Dependents:   PIDHeater Printer PIDHeater82 UltiSaverController

Fork of PID by Arnaud Suire

Revision:
1:117e0c36eb22
Parent:
0:d58c1b8d63d9
Child:
2:55bf0f813bb4
diff -r d58c1b8d63d9 -r 117e0c36eb22 PID.h
--- a/PID.h	Wed Feb 26 08:46:04 2014 +0000
+++ b/PID.h	Mon Jan 25 22:29:38 2016 +0000
@@ -1,14 +1,17 @@
-#pragma once
+//#pragma once
 
 #ifndef PID_H
 #define PID_H
 
+#define MANUAL_MODE 0
+#define AUTO_MODE   1
+
 class PID
 {
 public:
 
     /*
-    * Constructeur
+    * Constructor
     * Sets default limits, calculates tuning parameters, and sets manual mode with no bias.
     * @param Kc - Tuning parameter
     * @param tauI - Tuning parameter
@@ -53,6 +56,26 @@
     void setInterval(float interval);
 
     /*
+    * Set the target value for the PID loop to maintain.
+    * @param sp The target value to maintain.
+    */
+    void setSetPoint(float sp);
+
+    /*
+    * Set the target value for the PID loop to maintain.
+    * @param pv The target value to maintain.
+    */
+    void setProcessValue(float pv);
+
+    /**
+     * Set PID to manual or auto mode.
+     *
+     * @param mode        0 -> Manual
+     *             Non-zero -> Auto
+     */
+    void setMode(int mode);
+
+    /*
     * Set the bias.
     * @param bias The bias for the controller output.
     */
@@ -77,7 +100,8 @@
 private:
     
     bool usingFeedForward;
-
+    bool inAuto;
+    
     //Actual tuning parameters used in PID calculation.
     float Kc_;
     float tauR_;