I'm new to both StackExchange and electronics in general.
I want to be able to turn on and off a DC motor using my Raspberry Pi. I have a breadboard, a 6V DC motor, an NPN Transistor (ST 2N2222), a battery holder that holds 4 AA batteries (and consequently has a P.D. of about 6V), a raspberry pi, and wires. Also, can I use Pulse Width Modulation in this setup, and if so, how? If possible, please include circuit diagrams.
I know that this will be much easier to do using an IC Motor Controller (like L293D), but I want to know if it is possible using a transistor instead.
Thanks in advance.