Go Down

### Topic: PID library (Read 742 times)previous topic - next topic

#### xulingxuling23

##### Feb 12, 2013, 07:44 pm
i want to make PID linefollower so i use the library of PID_V1 http://playground.arduino.cc/Code/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

#1
up

#### Khalid

#2
##### Feb 13, 2013, 06:40 pm

can some one help to me?sorry if my english noob

First help us.. Try to put your sketch using #
Code: [Select]
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...

Go Up

Please enter a valid email to subscribe

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy