Scaling PID Output


i have implemented pid function using formula,

code: [select]

correction = kp * error + kd * (error - preverror) + ki * (sum of errors)


what should keep output between range? 0-255 if disregard value not between 0 255 produces jiggly behavior?

how about:

code: [select]
if (correction > 255) {
  correction = 255;
} else if (correction < 0) {
  correction=0;
}


--
the quick shield: breakout 28 pins quick-connect terminals


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Scaling PID Output


arduino

Comments