Its kind of strange (or I just don't understand how to do it), but I tried the following
In my setup code I set
pinMode(5, INPUT); // set pin to input
digitalWrite(5, HIGH); // turn on pullup resistors
Then in my loop I have
while (PIND & ( 1 << 5 )){
}
blablabla....
I thought that would make my code halt until I connect port D pin 5 (digital out 5 on arduino) to ground and only when I connect the pin to ground it will execute blablabla... ?
Or am I totally wrong?