Motor not turning off even after set to low.

Hi, this is my first post. I have followed this setup here and I have done everything correctly other than use a BC548 transistor instead of a TIP120. Everything seems fine but when I set the code to LOW after its set to HIGH the motor still stays on. However, when it is set to low, it stays of. Here is my code:

void setup(){
pinMode(4,OUTPUT);}
void loop(){
digitalWrite(4,HIGH);
delay(1000);
digitalWrite(4,LOW;
delay(1000);
}

Any suggestions? do I need a diode?

No Base resistor kills Arduino outputs.

Typical o/p wiring.

I have done everything correctly other than use a BC548 transistor instead of a TIP120.

BIG mistake. The BC548 is a low current transistor (100 mA maximum) and was probably fried instantly.

As stated above, a base resistor is required. You may have damaged the port pin as well.

do I need a diode?

With motors, relays and other coils, always.

Finally, do NOT attempt to power motors or servos from the 5V Arduino output. You can fry the Arduino voltage regulator as well. Instead, use a 4xAA battery pack and connect the grounds.

RyanE11:
Hi, this is my first post. I have followed this setup here and I have done everything correctly other than use a BC548 transistor instead of a TIP120.

TIP120 rated at 4A, 65W, with a switching gain of 2000 or so
BC548 rated at 0.1A, 0.3W, with a switching gain of 20.

Utterly different devices, no chance of substituting one for the other. Its like trying to use a tuk-tuk to haul a truck-trailer!

Any suggestions? do I need a diode?

Use a TIP120? Use a logic-level MOSFET?
You always need a free-wheel diode with an inductive load - that page you link is plain wrong, they are lucky the TIP120 is pretty tough, but without a diode it may get stressed to failure over time.