Arduino setup not working

I am trying to use an Uno and Shield (rev 3) to control a DC motor. I had this system set up perfectly with the code however after trying to rehouse the system it not doesnt work.
I setup the DC motor to spin in one direction when recieving a signal from input 6 and another for 7, the motor however spins even when there is any sort of wire in the port. (I literally had a piece of wire from pin 6 to thin air and the motor will begin to spin). Do you think this is a problem with the shield or am i missing something really obvious?
Cheers

watford98:
... when recieving a signal from input 6 and another for 7, ...

Hi,
Which signal type are you dealing with?
Regards

It's just a digital signal coming from a breadboard with a button and a resistor running from the 5V power off of the shield.

Cheers

watford98:
It's just a digital signal coming from a breadboard with a button and a resistor running from the 5V power off of the shield.

Cheers

What shield are you using?

Regards.

It's the official arduino one.

Cheers

watford98:
the motor however spins even when there is any sort of wire in the port.

This is a bad idea (leaving the wire act as an antenna).

Try first by:

Tying the inputs to 0 or 5 volts directly.

programming input with "INPUT PULLUP".

Regards

Thanks,

When I connect the motor to the shield with nothing else attached to the input pins the shield still draws a lot of current (2A). But the motor doesnt spin it just vibrates? Is this the input pullup?
Should i adjust my code to reverse the effect of the buttons?

Ok so this seems to have worked, instead of sending a positive signal through the input pins it now always sends a positive signal and then sending a ground signal will start the motor instead?
Cheers for the help

watford98:
Ok so this seems to have worked, instead of sending a positive signal through the input pins it now always sends a positive signal and then sending a ground signal will start the motor instead?
Cheers for the help

Your post is a bit confusing ...

Please, follow these steps and tell what happens:

  1. Tie input "6" to ground; tie input "7" to + 5: does the motor turn?. Which direction?
  2. Reverse inputs. same questions.

Regards.

Connecting pins 6 and 7 to ground makes the motor spins cw and acw, when the neither are connected to ground the motor doesnt spin.
Similar to how this works: http://www.instructables.com/id/Arduino-Button-with-no-resistor/

watford98:
Connecting pins 6 and 7 to ground makes the motor spins cw and acw, when the neither are connected to ground the motor doesnt spin.
Similar to how this works: http://www.instructables.com/id/Arduino-Button-with-no-resistor/

Will you please post the code?

#include <AFMotor.h>

AF_DCMotor motor(1);
const int buttonPin3 = 7;
const int buttonPin4 = 6;

int buttonState3 = 0;
int buttonState4 = 0;

void setup() {
pinMode(buttonPin3, INPUT_PULLUP);
pinMode(buttonPin4, INPUT_PULLUP);
pinMode(12, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {

buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);

if (buttonState3 == LOW) {

digitalWrite(12, HIGH);
digitalWrite(9, LOW);
analogWrite(3,255);

delay(5);
}

if (buttonState4 == LOW) {

digitalWrite(12,LOW);
digitalWrite(9,LOW);
analogWrite(3,255);

delay(5) ;
}

else if (buttonState3 == HIGH) {

digitalWrite(9,HIGH);

delay(5);

}
}

*The speed of the motor doesnt need to be controlled.