MCPcopy Create free account
hub / github.com/br3ttb/Arduino-PID-Library / PID

Method PID

PID_v1.cpp:20–37  ·  view source on GitHub ↗

Constructor (...)********************************************************* * The parameters specified here are those for for which we can't set up * reliable defaults, so we need to have the user set them. ***************************************************************************/

Source from the content-addressed store, hash-verified

18 * reliable defaults, so we need to have the user set them.
19 ***************************************************************************/
20PID::PID(double* Input, double* Output, double* Setpoint,
21 double Kp, double Ki, double Kd, int POn, int ControllerDirection)
22{
23 myOutput = Output;
24 myInput = Input;
25 mySetpoint = Setpoint;
26 inAuto = false;
27
28 PID::SetOutputLimits(0, 255); //default output limit corresponds to
29 //the arduino pwm limits
30
31 SampleTime = 100; //default Controller Sample Time is 0.1 seconds
32
33 PID::SetControllerDirection(ControllerDirection);
34 PID::SetTunings(Kp, Ki, Kd, POn);
35
36 lastTime = millis()-SampleTime;
37}
38
39/*Constructor (...)*********************************************************
40 * To allow backwards compatability for v1.1, or for people that just want

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected