It is currently Wed Mar 29, 2017 9:18 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Feb 15, 2017 12:48 pm 
Offline
Member
Member

Joined: Thu Jan 23, 2014 1:36 pm
Posts: 7
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
}


Top
 Profile  
 
PostPosted: Mon Feb 20, 2017 12:02 pm 
Offline
User avatar
Velleman Support
Velleman Support

Joined: Wed Jan 11, 2017 2:48 pm
Posts: 6
Hello

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
}


Regards,

Velleman Support


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group