ATMega32 digitalRead and write trouble

Try a simpler connection setup:

I think D1 will read low as that is the Serial output pin, and it will only go high when it is sending a '1' out.