I am new to circuit design, and I have some questions about a circuit I'm seeing in a raspberry pi starter kit. I think my questions is elementary, but I am having trouble finding an answer due to my limited knowledge of what keywords to search.
The starter kit I am using proposes a circuit in which a series of LEDs will turn on and off in sequence. The circuit design as well as a description of the project can be found on page 72 of this document: https://github.com/Freenove/Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi/blob/master/Tutorial.pdf
Note that power flows from one of the constant 3V3 pins to the 220 Ohm resistors, the LEDs, and finally the IO pins.
The code for the project is here: https://github.com/Freenove/Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi/blob/master/Code/Python_Code/03.1.1_LightWater/LightWater.py
In the setup
function of the python script, the GPIO pins are initialized as output pins in HIGH mode which defaults to the LEDs being off. I do not understand this behavior. Why does sending constant 3V3 power to a pin in output mode (specifically set to HIGH) result in the LED not turning on? It seems to me that this would not work or could even potentially be dangerous to the components as the code appears to be demanding conflicting behavior. However, the code and circuit does indeed work. When the led output is set to low the light comes on. How can I understand this behavior?
Additionally, why is there no need to include a ground wire in the circuit? My design for a circuit that accomplishes the same task would go from each IO pin in output mode to a resistor and LED and then to a common wire that leads to ground. I would initialize each pin as an output pin in LOW mode. Then changing the output to HIGH would turn on the LED.
I have used both their method and mine. Both methods appear to work, but I do not understand why theirs works.
Apologies for lack of clarity or abuses of terminology.