Stepper only stepping one way!?

my stepper motor (bi) is only stepping anti clockwize when the code is asking it to go 24 anti clockwize then 24 clockwize.

can anyone tell me if anything is wrong with the code?


// define the pins that the motor is attached to. You can use
// any digital I/O pins.

#include <Stepper.h>

#define motorSteps 24    // change this depending on the number of steps
                           // per revolution of your motor
#define motorPin1 8
#define motorPin2 9
#define ledPin 13

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2); 

void setup() {
  // set the motor speed at 60 RPMS:

  // Initialize the Serial port:

  // set up the LED pin:
  pinMode(ledPin, OUTPUT);
  // blink the LED:

void loop() {
  // Step forward 24 steps:

  // Step backward 24 steps:


// Blink the reset LED:
void blink(int howManyTimes) {
  int i;
  for (i=0; i< howManyTimes; i++) {
    digitalWrite(ledPin, HIGH);
    digitalWrite(ledPin, LOW);

all it dose is go one 24steps one way, then twitch and go on about 23 steps in the same direction.

when i change the code to

  // Step backward 24 steps:

taking out the -24 and change it to just 24, I get the a 360 turn as you would expect!

My guess is that you hokked the wires to the motor up wrong.

Try to check it.