Can't wire my stepper motor to make it work!

Hi, i have found that I have the same board and stepper, so I set it up, it did work, but there was no direction change.
Try this sketch, that I found ages ago and moded so that it runs without a speed pot.
Used pins 2,3,4,5 and see what happens, this stepper is 5V and I am able to run it off the arduino 5V.

/* 
 Stepper Motor Control - speed control
 
 This program drives a unipolar or bipolar stepper motor. 
 The motor is attached to digital pins 2 - 5 of the Arduino.
 A potentiometer is connected to analog input 0.
 
 The motor will rotate in a clockwise direction. The higher the potentiometer value,
 the faster the motor speed. Because setSpeed() sets the delay between steps.
 
 */


int IP1;
int IP2;
int IP3;
int IP4;
int val;
int ddelay;
int dddelay;

void setup() {
  // nothing to do inside the setup
  IP1=2;
  IP2=3;
  IP3=4;
  IP4=5;
  Serial.begin(9600);
  pinMode(IP1,OUTPUT);
  pinMode(IP2,OUTPUT);
  pinMode(IP3,OUTPUT);
  pinMode(IP4,OUTPUT);
}

void loop() {
//  val = analogRead(0);
val=1000;   //   Sets speed 0 to 1000
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
 
  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, LOW);
  delay(dddelay);
 //  val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(dddelay,3,500);
    Serial.print(ddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
}

val is set to 1000, the lower the value the slower the speed, so you can see the stepper control strobe.

Hope it helps.

Tom... :slight_smile: