EM-483 Stepper Motor with EasyDriver

I had problems figuring this thing out, so i thought i would post up how i got it working. Maybe someone will do a Google search some time and find this post and it will help them out. (Wish someone made a post like this for me, lol)

//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License - Please reuse change and share
//Using the easy stepper with your arduino
//use rotate and/or rotateDeg to controll stepper motor
//speed is any number from .01 -> 1 with 1 being fastest - 
//Slower Speed == Stronger movement
/////////////////////////////////////////////////////////////////


#define DIR_PIN 2
#define STEP_PIN 3

void setup() { 
  pinMode(DIR_PIN, OUTPUT); 
  pinMode(STEP_PIN, OUTPUT); 
} 

void loop(){ 

  rotateDeg(360, 1); 
  delay(1000);
  rotateDeg(-360, .1);  //reverse
  delay(1000); 



  //rotate(1600, .5); 
  //delay(1000); 
  //rotate(-1600, .25); //reverse
  //delay(1000); 
  
}



void rotate(int steps, float speed){ 
  //rotate a specific number of microsteps (8 microsteps per step) - (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (steps > 0)? HIGH:LOW;
  steps = abs(steps);

  digitalWrite(DIR_PIN,dir); 

  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){ 
    digitalWrite(STEP_PIN, HIGH); 
    delayMicroseconds(usDelay); 

    digitalWrite(STEP_PIN, LOW); 
    delayMicroseconds(usDelay); 
  } 
} 

void rotateDeg(float deg, float speed){ 
  //rotate a specific number of degrees (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (deg > 0)? HIGH:LOW;
  digitalWrite(DIR_PIN,dir); 

  int steps = abs(deg)*(1/0.225);
  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){ 
    digitalWrite(STEP_PIN, HIGH); 
    delayMicroseconds(usDelay); 

    digitalWrite(STEP_PIN, LOW); 
    delayMicroseconds(usDelay); 
  } 
}

Hi, I have the same stepper motor and easyDriver, you could put the scheme of as you connected the motor and easyDriver?

It would probably also be useful to others if you explained what problem you had and how the code you have posted solved the problem.

That could be very helpful for someone who has nearly, but not quite the same problem.

It might also be useful to post the link from which you got the code.

...R

I found this stepper motor in a box today. pulled it out to play with it, googled this, and found my own old post... interesting...

Anyway, the stepper motor came out of an old printer.
Here is how i wired it up, the code above works.

Resurrected for a thank you....

Just pulled one of these.