i want to make PID linefollower so i use the library of PID_V1 Arduino Playground - PIDLibrary
make an PID linefollower i must make a formula for PID count like
KP KD KI
for example:
void pid_calc()
{ position = int(sensors_average / sensors_sum);
proportional = position – set_point; // Replace set_point by your set point
integral = integral + proportional;
derivative = proportional - last_proportional;
last_proportional = proportional;
void calc_turn()
{ //Restricting the error value between +256.
if (error_value < -256)
{
error_value = -256;
}
if (error_value > 256)
{
error_value = 256;
}
// If error_value is less than zero calculate right turn speed values
if (error_value < 0)
{
right_speed = max_speed + error_value;
left_speed = max_speed;
}
// If error_value is greater than zero calculate left turn values
else
{
right_speed = max_speed;
left_speed = max_speed - error_value;
}
}
the code i have copied from pdf build auto linefollower PID ,its famous PDF arduino but i cant use it and understand it because itus very complicated with too many errors
now i wanna use PID_V1 library but i dont understand what the function mean it eventhough i read from the arduino playround but i cant applicated to code above
can some one help to me?sorry if my english noob