Hello, The stepper motor does not reverse direction with the following code. Any suggestions? Thank you!
[code]/---------------------------------------------
February 13, 2017 Project for Daniel’s lamp
Using an Arduino Uno to control a Velleman VMA401 5VDC stepper motor
controlled by a ULN2003 driver board.
----------------------------------------------/
#include <Stepper.h> //include the function library #define STEPS 64 // 64 steps per rev
Stepper stepper1(STEPS, 8, 9, 10, 11); //create the stepper1
void setup()
{
Serial.begin(9600); // initialize serial communication:
}
void loop()
{
stepper1.setSpeed(120); //set speed to 10 rpm
stepper1.step(640); //move 360 deg one direction
delay(1000); //pause for effect
stepper1.step(-640); //move 360 deg in the other direction
delay(1000); //pause
}[/code]
Please try this code. Normally the stepper motor should now turn clock and counterclockwise.
[code]/---------------------------------------------
February 13, 2017 Project for Daniel’s lamp
Using an Arduino Uno to control a Velleman VMA401 5VDC stepper motor
controlled by a ULN2003 driver board.
----------------------------------------------/
#include <Stepper.h> //include the function library #define STEPS 64 // 64 steps per rev
Stepper stepper1(STEPS, 11, 9, 10, 8); //create the stepper1
void setup()
{
Serial.begin(9600); // initialize serial communication:
}
void loop()
{
stepper1.setSpeed(120); //set speed to 10 rpm
stepper1.step(640); //move 360 deg one direction
delay(1000); //pause for effect
stepper1.step(-640); //move 360 deg in the other direction
delay(1000); //pause
}[/code]