When responding to generic "Arduino" questions, we assume ATMega328p devices such as the Uno. This means every I/O has protection diodes. Ideally you don't use them but it is ok for down and dirty circuits. A single NPNPNP with a current limiting resistor on the base can accomplish this switching task if you exploit the protection diode or use an external diode. To set "on" you set the I/O to low. To set "off" you set the I/O pin to input. This isn't best practice, but it does work.