A transistor is a semiconductor device commonly used to amplify or switch electronic signals. In this project, a power transistor is used as a digital switch. When pin 9 (digital output) is HIGH, the LEDs will turn on, and when LOW the LEDs will turn off. Using a power transistor with an Arduino pinout will allow you, for example, to control outputs with a higher current or voltage source than Arduino pins support.

Use an NPN Power Transistor, one 1k resistor, and 220 Ohm resistors for the LEDs. Connect the LEDs in parallel to 5 volts using 220 Ohm resistors. Connect the BASE (transistor's left leg) through a 1k resistor to pin 9, the COLLECTOR (middle leg) to the ground legs of the LEDs and the EMITTER (right leg) to ground.