


The anode of LED 2 is connected to GPIO 2 via a series resistor, which also applies to the anode of LED3 and GPIO 3. The cathodes of LEDs 2 and 3 are also directly connected to GPIO number 4, which means that 5V are applied here. The equivalent circuit on the right shows that there is now 5V on the cathode of LED 1 - which is directly connected to GPIO 4 - and 2V on the anode, by what this diode is switched in reverse direction and no longer lights up. Now, GPIO number 4 is also set to HIGH level, which turns LED 1 OFF, while LEDs 4 and 7 remain ON. The three LEDs are connected in parallel as can be seen in the equivalent circuit to the right of the matrix. The resistor at GPIO number 1 forms a voltage divider with the three LEDs, polarized in forward direction. In the following, we assume that the logic level is 5V and the threshold voltage of the LEDs is 2V. The threshold voltage can be measured at the anodes that are directly connected to one another. This voltage depends on the type of LED used and is usually in the range of 1V to 3V.

Consequently the threshold voltage drops across the LEDs. LOW signal, thus 0V, is on the cathodes (tip of the triangle with the dash at the diode symbol) of the three LEDs, the anodes (blunt side of the triangle) are connected to HIGH signal, i.e. Now GPIO number 1 is set to HIGH signal, with which LEDs number 1, 4 and 7 are connected in forward direction and so start to light up. There is a LOW signal on all GPIOs, with which no voltage can be measured at any point in the matrix - all LEDs are switched off. The three columns are connected to GPIOs 1, 2 and 3 via a 1kΩ resistor, the rows directly to GPIOs 4, 5 and 6. List of parts including links to online shops.Example circuit 6圆 matrix including parts list.
