Hello,
I have a programm in where a servo moves periodically and after reaching a certain position it should stop and wait till PIND4 is pressed. In the meantime it should be possible to move it manually through pushing the buttons PIN1 and PIN0. In my example after reaching that position it stops but cant be moved through the pushing of the buttons PD0 and PD1.
I would be grateful for any help.
I have a programm in where a servo moves periodically and after reaching a certain position it should stop and wait till PIND4 is pressed. In the meantime it should be possible to move it manually through pushing the buttons PIN1 and PIN0. In my example after reaching that position it stops but cant be moved through the pushing of the buttons PD0 and PD1.
- Code:
PIND1,PIND0 and PIND4 are set high
OCR1B = ICR1 - (1000+pos*100);
while((PIND & (1<<4))); // Wait till PIND4 is pressed
{
if(!(PIND & (1<<0)))
{
OCR1B=OCR1B-100;
_delay_ms(10);
}
if(!(PIND & (1<<1)))
{
OCR1B=OCR1B+100;
_delay_ms(10);
}
}
I would be grateful for any help.