Hi, i'm trying to set a single pin high inside a If condition loop, like
if(PORTD |= (1 << PD1))
PORTC= 0xFF; //Turns ON All LEDs
if(PORTD |= (1 << PD7))
PORTC ^= 0xFF; // Turns ON All LEDs
_delay_ms(1000); // long enough for human eye
but the problem is that the LED is high even when the condition is not being executed. That is when the "PROGRAMMER" is just connected to ATMEGA32U4, the 5v makes the LED condition execute even without running the actual program. I dont know why the LED starts glowing when Vcc and IF conditions are not even executed.
Please help me.