I'm completely clueless!

Hello,
I wonder if anyone could help me please. I'm completely clueless and will be very grateful.

I want to turn a 6V mini motor to turn on and off. Firstly what end of the wire goes in to the Digital PMW and what wire goes in to ground, plus does the wire just fit in or does it need soldering/an adapter?

Aswell as this, do i need any other components or can I plug the motor straight in to the board?

Finally can you check this code please:

-------------------------------------------------------------------
// the pin the Components are attached to **
int motor = 6;
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(motor, OUTPUT);
void loop() {
** digitalWrite(Motor, HIGH);

** delay(3000); // wait for 3 Seconds**

** digitalWrite(Motor, LOW);**
}

Thank you for reading my question, hope you can help me.

Best wish's,
Josh.

Please tell us you haven’t directly connected a DC motor to an Arduino I/O pin.

I think you should use a driver circuit in between the arduino and motor and use a different power for the motor. A 6V motor will likely need more current then the arduino can supply.

joshmead923:
Aswell as this, do i need any other components or can I plug the motor straight in to the board?

You must NOT connect a motor directly to an Arduino I/O pin. It cannot provide enough current and it will probably damage your Arduino. Also electric motors generate brief high-voltage spikes that can also damage an Arduino.

As you want speed control you need a motor driver or H-Bridge between the Arduino and the motor. Have a look at the Pololu website to get an idea of the sorts of thing that are available. You need to choose a motor driver that can handle the voltage and the current that your motor requires.

...R

Robin2:
you need a motor driver or H-Bridge between the Arduino and the motor. Have a look at the Pololu website to get an idea of the sorts of thing that are available. You need to choose a motor driver that can handle the voltage and the current that your motor requires.

Thank You,
I'll have a look.