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

Method SetSampleTime

PID_v1.cpp:134–144  ·  view source on GitHub ↗

SetSampleTime(...) ********************************************************* * sets the period, in Milliseconds, at which the calculation is performed ******************************************************************************/

Source from the content-addressed store, hash-verified

132 * sets the period, in Milliseconds, at which the calculation is performed
133 ******************************************************************************/
134void PID::SetSampleTime(int NewSampleTime)
135{
136 if (NewSampleTime > 0)
137 {
138 double ratio = (double)NewSampleTime
139 / (double)SampleTime;
140 ki *= ratio;
141 kd /= ratio;
142 SampleTime = (unsigned long)NewSampleTime;
143 }
144}
145
146/* SetOutputLimits(...)****************************************************
147 * This function will be used far more often than SetInputLimits. while

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected