Society of Robots - Robot Forum

Software => Software => Topic started by: Klinger on March 09, 2009, 10:01:39 AM

Title: Servo program help!!!
Post by: Klinger on March 09, 2009, 10:01:39 AM
Hello

I need help with my atmega640 I am using HS 645MG servos
When I program the servo to stay at one position i works fine
But when I try to get them to move  from one position to another it just stay in the one position

example of how I am trying to move them

servo(PortA,6, 700)
delay_ms(20)

count++

if count > 20000
while(1)
{
servo(portA,6,500)
delay_ms(20)
}

the servo.hex code works But i was wonder if someone could help me get the servo to move from one positiion to another
Title: Re: Servo program help!!!
Post by: Admin on March 19, 2009, 03:58:45 AM
Do this to slowly change from one position to another:

Code: [Select]
long int i;

for(i=2000;i<11000;i++)
     {
     servo(portA,6,i/10);
     delay_ms(20);
     }

Is that what you meant?