I'v bin working on an arduino powered rc robot, I'v pulled out the old chip and my arduino is plugged into the motor via transistor and pins, the transistor has an external supply and grounds are connected but, all it does is make a weird buzzing in the motor. the buzz does change tone witch makes me think the arduino is doing something. I will put my code and pic of wiring below. please help.
1k resistor and the transistors # is 2N 2904 331 and the power supply is a 6v rechargeable that came with the car
int motorPin = 9;
void setup(){
(motorPin, OUTPUT);
}
void loop(){
analogWrite(motorPin, 255);
delay(1000);
analogWrite(motorPin, 200);
delay(1000);
analogWrite(motorPin, 100);
delay(1000);
analogWrite(motorPin, 0);
delay(1000);
}
