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. ***************************************************************************/
| 18 | * reliable defaults, so we need to have the user set them. |
| 19 | ***************************************************************************/ |
| 20 | PID::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 |
nothing calls this directly
no outgoing calls
no test coverage detected