I'm trying to understand the logic behind how the LED functions and why exactly we're doing it the way we are in the $50 robot tutorial.
In the tutorial, it shows VCC goes to positive LED pin. Negative led pin goes to resistor which goes to Microcontroller. Understood.
VCC-->
- LED[-]-->resistor-->Some Port on Atmega8
What I don't understand is, why does switching off the port enable to LED to light up? I'm rather new to the concept of electrical flow through electronics, but as far as I understand, VCC will send a current through the LED which goes out through the negative lead, into the resistor and attempts to then hit the MCU. Does turning the port low somehow ground the connection and allow the LED to turn on? If that's the case, what does turning the port on do in terms of the electrical circuit that forces the LED to stay off (or rather, not make a connection to ground)?
Is there a reason this approach was taken rather than connecting port X on the MCU to the positive lead on the led and connecting the negative lead of the LED to ground (after hitting a resistor)? It seems more intuitive to me that way, but I figured there was a reason this approach was taken.
Atmega8-->
Thanks!