MisterBotBreak
Published

How to Code Step Motor

In this project we will learn how to use step motor with code.

BeginnerProtip1 hour52,182
How to Code Step Motor

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×6
Arduino UNO
Arduino UNO
×1
Step motor with driver
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Step motor .ino

Arduino
#include <Stepper.h> 

int numberofstep = 48*64; 
                                  

Stepper motor(numberofstep,9,11,10,6);    // we use pins 9, 11, 10, 6        
void setup() 
{ 
 
  motor.setSpeed(9); // we set motor speed at 9
}
void loop() 
{ 
  motor.step(600); // the motor will run during 600 step (you can change the step)
  motor.step(-800); // the motor will run during 800 step in reverse (you can change the step)

}

Credits

MisterBotBreak

MisterBotBreak

48 projects • 149 followers
I love electronics and cats :D !
Thanks to Pierre Loc ( pictures ).

Comments