I have done the following program but servo motor is rotating fully. I cant control the angle.
Rich (BB code):
#include<avr/io.h>
#include<compat/deprecated.h>
#include<util/delay.h>
main()
{
sbi(DDRD,5);
while(1)
{
int i;
for(i=10000; i > 0; i--)
{
sbi(PORTD,5);
_delay_ms(0.6);
cbi(PORTD,5);
_delay_ms(19.4);
}
for(i=10000; i > 0; i--)
{
sbi(PORTD,5);
_delay_ms(1.5);
cbi(PORTD,5);
_delay_ms(18.5);
}
for(i=10000; i > 0; i--)
{
sbi(PORTD,5);
_delay_ms(2.4);
cbi(PORTD,5);
_delay_ms(17.6);
}
}
}
Last edited by a moderator: