-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Added capability for Proportional On Measurement -Changed license from GPLv3 to MIT
- Loading branch information
Showing
6 changed files
with
135 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************** | ||
* PID Proportional on measurement Example | ||
* Setting the PID to use Proportional on measurement will | ||
* make the output move more smoothly when the setpoint | ||
* is changed. In addition, it can eliminate overshoot | ||
* in certain processes like sous-vides. | ||
********************************************************/ | ||
|
||
#include <PID_v1.h> | ||
|
||
//Define Variables we'll be connecting to | ||
double Setpoint, Input, Output; | ||
|
||
//Specify the links and initial tuning parameters | ||
PID myPID(&Input, &Output, &Setpoint,2,5,1,P_ON_M, DIRECT); //P_ON_M specifies that Proportional on Measurement be used | ||
//P_ON_E (Proportional on Error) is the default behavior | ||
|
||
void setup() | ||
{ | ||
//initialize the variables we're linked to | ||
Input = analogRead(0); | ||
Setpoint = 100; | ||
|
||
//turn the PID on | ||
myPID.SetMode(AUTOMATIC); | ||
} | ||
|
||
void loop() | ||
{ | ||
Input = analogRead(0); | ||
myPID.Compute(); | ||
analogWrite(3,Output); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters