Society of Robots - Robot Forum

Software => Software => Topic started by: kupter on December 08, 2010, 09:20:48 PM

Title: How to control servo futaba s3003
Post by: kupter on December 08, 2010, 09:20:48 PM
I'm still confuse how to control servo... I already read paper how to control

http://extremeelectronics.co.in/avr-tutorials/servo-motor-control-by-using-avr-atmega32-microcontroller/ (http://extremeelectronics.co.in/avr-tutorials/servo-motor-control-by-using-avr-atmega32-microcontroller/)

I use atmega 16 withc crystal 11.059MHz
Code: [Select]
#include <avr/io.h>

#include <util/delay.h>

//Simple Wait Function
void delay_ms(int ms)
{
for (int i=0;i<ms;i++){_delay_ms(1);}}

void main()
{
   //Configure TIMER1
   TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11);        //NON Inverted PWM
   TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM)
   

   DDRD|=(1<<PD4)|(1<<PD5);   //PWM Pins as Out

   while(1)
   {

      OCR1A=67;   //0 degree
      delay_ms(20);
      OCR1A=218;  //90 degree
      delay_ms(20);
  OCR1A=294;  //135 degree
      delay_ms(20);
  OCR1A=370;  //180 degree
      delay_ms(20);


   }
}

when I use servo continous servo that can be work...but when i use servo futaba S3003  servo can;t work


somebody can help me

Title: Re: How to control servo futaba s3003
Post by: Admin on January 11, 2011, 02:01:37 PM
Did you get it to work?

have a look here:
http://www.societyofrobots.com/actuators_servos.shtml (http://www.societyofrobots.com/actuators_servos.shtml)