At the start of my code (after declaring variables) I'm setting Pin D0 as an input with pullup enabled
DDRD &= ~(1 << PIND0); //Set as input
PORTD |= (1 << PIND0); // enable the pull-up on PD0
//Check if low (jumper closed
if(!(PIND & (1 << PIND0) ))
//reset TWI Address to default
What I'm finding is that if I don't put in a delay after setting the pullup, the IF statement finds that the voltage is low and goes in to my reset routine.
If I place a 50ms delay before the IF statement it works as expect.
Is this normal behaviour, ie do I need to let things 'settle' before the test?