The Raspberry Pi 2 GPIO pins output 3,3V max. 500mA. To use a higher voltage or more current we need a voltage level converter. The Transistor as Switch is the voltage level converter.
Learn more about the Raspberry Pi 2 and learn how to use it/program with it go to:
www.howtoelectronic.wordpress.com