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.
Dependents: PID_VelocityExample TheProgram
Fork of PID by
Diff: PID.h
- Revision:
- 2:690958d56f3e
- Parent:
- 0:6e12a3e5af19
--- a/PID.h	Fri Sep 25 13:10:29 2015 +0000
+++ b/PID.h	Tue Oct 06 10:16:40 2015 +0000
@@ -146,12 +146,16 @@
      * @param bias The bias for the controller output.
      */
     void setBias(float bias);
-
+    
+    // set the deadzone
+    void setDeadzone(float top, float bottom);
+    
     /**
      * PID calculation.
      *
      * @return The controller output as a float between outMin and outMax.
      */
+        
     float compute(void);
 
     //Getters.
@@ -186,6 +190,7 @@
     float prevProcessVariable_;
     //The output that affects the process variable.
     float controllerOutput_; 
+    float controllerOutputSum_;
     float prevControllerOutput_;
 
     //We work in % for calculations so these will scale from
@@ -201,7 +206,10 @@
     float accError_;
     //The controller output bias.
     float bias_;
-
+    //The controller deadzone.
+    float deadzoneTop_;
+    float deadzoneBottom_;
+        
     //The interval between samples.
     float tSample_;          
 
    