Author Topic: axon servo source code  (Read 3151 times)

0 Members and 1 Guest are viewing this topic.

Offline AaronTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
axon servo source code
« on: October 03, 2010, 01:08:08 PM »
does anybody know the full source code on how to get a hitec servo to rotate 360 degrees using the axon
i already modified the servo and i know how to chose which pin i want but i don't know the rest of the code
 

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: axon servo source code
« Reply #1 on: October 03, 2010, 02:05:48 PM »
If you're using webbotlib, go look up the Servo class, otherwise:

Here's some pseudocode (works on any controller with a decent timer):


Code: [Select]
repeat every ~20 uS: {
  set SERVOPIN HIGH
  delay 2000uS // 2000: 100% fwd, 1000: 100% bwkd, 1500: stop, use some linear interpolation
  set SERVOPIN LOW
}

You'll have to provide a little more information for any more help than this, I think.  I'm assuming you mean rotate continuously in fwd or reverse directions, as if the servo's modified, its positioning feedback is gone... also, 0 = 360deg.
« Last Edit: October 03, 2010, 02:08:27 PM by rbtying »

Offline AaronTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: axon servo source code
« Reply #2 on: October 03, 2010, 02:52:08 PM »
that helps but i need to know the entire code all i know is how to identify the servo ports
Code: [Select]
SERVO(PORTA, 5,360)

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: axon servo source code
« Reply #3 on: October 03, 2010, 02:58:57 PM »
What library are you using?  You obviously have a servo object there...

I'm not familiar with AVRLib, but the $50.00 robot uses code much like my pseudocode:

Code: [Select]
// other code...
PORT_ON(PORTD, 0);
 // turn on the port
delay_cycles(speed);
 // delay for speed cycles
PORT_OFF(PORTD, 0);// turn off the port
delay_cycles(200);

 


Get Your Ad Here

data_list