Arduino Forum

Topics => Robotics => Topic started by: yangkai on Apr 06, 2016, 04:57 am

Title: PID control the pwm speed question
Post by: yangkai on Apr 06, 2016, 04:57 am
Hi, If I want to set the PID output from 0 to 100 when error goes from 48 to 0.
can I write: PID_output(-100/48*error+kd*(error-last_error)+ki*error_sum)+100?
Because I want to decrease the PWM speed by pwm_speed=initial_speed-PID_output

OR just directly set the PID_output to PWM speed?
Like:pwm_speed=error*100/48+kd*(error-last_error)+ki*error_sum??

Thanks.