Hi , Sorry to go over old ground but i am trying to use a simple input to start a loop. As You can see i am using the led_blink code as a base.
I have written the bootloader to the chip and all is OK.i It runs as it is written on a 328p

I know the pin is set as an input by measuring the voltage on the pin to see if it is high. I have tried all the examples I have found in the forum ( mostly refer to port c) but I cannot get it to work,
All I want to do is wait until the input is low to start the while loop.

May 28, 2012
by pcbolt

Hi Heno2au -

If you would like to have the loop execute it's code ONLY when PD7 is low, all you'd need is something like this:

while(1) {
if (PIND & (1<<PD7)) continue; // if PD7 is high -> go to the start of the loop
// the rest of the LED code follows...

If you want to execute the loop code every time AFTER PD7 goes low, do something like this: