br3ttb / Arduino-PID-Library

1.91k stars 1.1k forks source link

how to reset PID output value after runing #112

Closed gunaone closed 3 years ago

gunaone commented 3 years ago

when i run it, at Output PID 255 and i stop execute it, how i can reset it to 0 again. i try with still running the PID with input far from set poin, its not enough fast to get down to 0 output PID again.

much thans,

br3ttb commented 3 years ago

when the pid turns on, it initializes based on the current value of the output variable. So this should work: Pid.setmode(manual) Output=0 Pid.setmode(automatic)

On Fri, Jun 11, 2021, 6:06 AM guna_on3 Hatibie @.***> wrote:

when i run it, at Output 255 and i stop execute it, how i can reset it to 0 again. i try with still running but set input high, its not enough fast to get down to 0 again.

much thans,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/br3ttb/Arduino-PID-Library/issues/112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACYX4WWGOPMI7TJ4HNPM3DTSHN3LANCNFSM46QMZAOA .

gunaone commented 3 years ago

thanks @br3ttb for your reply

so , just execute this code once : ? void reset_PID() { Pid.setmode(manual); Output=0; Pid.setmode(automatic); }

br3ttb commented 3 years ago

assuming that "Output" is the name of the variable you linked with the pid in the constructor, and you want to drop it to 0, then yes.

If you have any error (setpoint!=input) then the output might not be exactly 0 at startup, because of the pterm contribution.

On Sat, Jun 12, 2021, 10:18 PM guna_on3 Hatibie @.***> wrote:

thanks @br3ttb https://github.com/br3ttb for your replay

so , i just execute this code once : void reset_PID() { Pid.setmode(manual); Output=0; Pid.setmode(automatic); }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/br3ttb/Arduino-PID-Library/issues/112#issuecomment-860140180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACYX4XWPLKOL74JOUOVENDTSQIQ3ANCNFSM46QMZAOA .

gunaone commented 3 years ago

thanks @br3ttb , it's very helpful... 😊😊😊✔