Multiple LED Control Using Minimum I/O pins
A truth table for controlling six LEDs using three I/O is shown below:

H = Output Set high (5V)
L = Output set low (ground)
I = Input
More LEDs can be controlled by using this equation:
Numbers of LEDs = (Numbers of PINs) x ( Numbers
of PINs – 1)
For example:
Number of LEDs = 4 x (4-1)
= 4 x 3
= 12 LEDs