Hi. I am trying to control my servo with this code. But my servo just rotates 90 degrees and then stops. According to my code it should move to 2 different degrees. Please help. I couldn't figure out what to do. Thanks.
Code:
void servo(unsigned long int b)
{
output_high(pin_d0);
delay_us(b);
output_low(pin_d0);
delay_us(20000-b);
}
Servos require a pulse of 0.5mSec for one end of their travel to 2.5mSec for the other end. The standard pulse repetition 'interval' is every 20mSec. 2mSec full scale range.
Think about it. With your code, the pulse is changing from 400uSec to 600uSec. The first shorter than the shortest servo pulse is meant to be, and the second only 100uSec into the range. About 9 degrees (assuming a 180 degree servo travel).
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum