I am doing a personal project to learn a bit about electronics but I do not have much prior knowledge about it.
I am using a STM32L476RG microcontroller, a 3 digit seven segment display (common cathode), a 1N4148 diode and a 220Ω resistor.
My initial issue was that when the digit was meant to be off (but the segments should be on to light other digits), there was a dull light on the segments. To get around this, I put a 220Ω resistor in series with the common pins on the seven segment display. This fixed the issue of the digit being dull when it should be off, but it made the digits dull when they were meant to be on.
So to bypass the resistor when the digit is meant to be on, but not when the digit is meant to be off, I added a small signal diode in parallel with the resistor. A diagram of a single segment in this layout looks like the below. This shows the diode and resistor attached to pin 12 (the pin that controls digit 1 being on or off).
simulate this circuit – Schematic created using CircuitLab
The way I thought this would work was when the segment pin is high and the digit pin is low, the segment would be on and be bright (which it is) as it goes through the diode. But when the segment pin is high and the digit pin is also high, the segment would be off as it is going through the resistor. However, this is not the case, when both pins are high, the segment is on and dull as if it were still going through the diode.
What am I doing wrong?
A comparison of the when the diode should be on and off with the resistor and the resistor / diode. The segment pins are all high and it is the common digit pin that is high for off and low for on.
The 3 digit 7 segment display pin layout for reference.
Edit