 Charlieplexing can even be used to use pulse-width modulation to control the brightness of 12 LEDs.In following code example, the circuit uses ATtiny 8-pin microcontroller which has 5 I/O pins to create a 7-segment display.Since a 7-segment display only requires control of 7 individual LEDs, we use 4 of the ATtiny I/O pins as charlieplexed outputs (n*(n-1)).