Society of Robots - Robot Forum
Software => Software => Topic started by: Parth on June 07, 2008, 09:48:42 PM
-
I just have a quick question: does "Servo 0, 150" center a servo no matter how many degrees it can turn? For instance, if i had a servo that could rotate 200 degrees and a servo that could rotate 90 degrees, could I write the same code to center both of them? BTW this is for PICAXE. Thanks in advance!
-
check the servo specs
if it says pulse range from 1 to 2 ms then the center is 1.5 ms
so you provide a constant PWM signal of 1.5ms as logic HIGH and 20ms logic LOW
always make it the center of the pulse range
-
OK, thanks! So, I have a question specifically for the Hitec HS-311. Would I write Servo 0, 150? I got this because it has a pulse width of 1-2, so 1.5 would be the middle, and I would write it as 150. Am I right?
-
this depends on how you are writing delays in your compiler
i never did use already made functions for servos
but lets do it this way
while(1)
{
PORTD.0=1;
delay_us(1500);
PORTD.0=0;
delay_ms(20);
}
i did use PORTD.0 as output (servo control pin)
and also you should include delay.h
-
OK, thanks for all the help! :)