Proportional, integral, derivative controller library. Ported from the Arduino PID library by Brett Beauregard.

Fork of PID by Aaron Berk

Revision:
1:709ed452cc4c
Parent:
0:6e12a3e5af19
Child:
2:124819d33ba6
Child:
3:0f1bc3b0d050
--- a/PID.cpp	Thu Sep 02 16:48:10 2010 +0000
+++ b/PID.cpp	Thu May 14 12:28:08 2015 +0000
@@ -156,7 +156,7 @@
     Kc_   = Kc;
     tauR_ = tempTauR;
     tauD_ = tauD / tSample_;
-
+    
 }
 
 void PID::reset(void) {
@@ -223,7 +223,7 @@
 float PID::compute() {
 
     //Pull in the input and setpoint, and scale them into percent span.
-    float scaledPV = (processVariable_ - inMin_) / inSpan_;
+    scaledPV = (processVariable_ - inMin_) / inSpan_;
 
     if (scaledPV > 1.0) {
         scaledPV = 1.0;
@@ -231,14 +231,14 @@
         scaledPV = 0.0;
     }
 
-    float scaledSP = (setPoint_ - inMin_) / inSpan_;
+    scaledSP = (setPoint_ - inMin_) / inSpan_;
     if (scaledSP > 1.0) {
         scaledSP = 1;
     } else if (scaledSP < 0.0) {
         scaledSP = 0;
     }
 
-    float error = scaledSP - scaledPV;
+    error = scaledSP - scaledPV;
 
     //Check and see if the output is pegged at a limit and only
     //integrate if it is not. This is to prevent reset-windup.