Author Topic: Servo program help!!!  (Read 3533 times)

0 Members and 1 Guest are viewing this topic.

Offline KlingerTopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Servo program help!!!
« 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
« Last Edit: March 09, 2009, 06:53:14 PM by Klinger »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: Servo program help!!!
« Reply #1 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?

 

SMF spam blocked by CleanTalk