Pages: [1]   Go Down
Author Topic: Help getting Stepper Driver going?  (Read 645 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

My stepper motor and driver arrived today, after some help from a forum member in an earlier thread I think I have it hooked up correctly. But at the moment all I can get out of the motor is 2 steps. I'm just using a simple code as I understand all I need to do is send pulses of 5v to the optically isolated switches on the driver and it will do the rest. I have fiddled with the enable mode, but it makes no difference and the same with direction, I still only get 2 steps. Is my code overly simple?

Code:
const int pul =  7;  //set pulse at pin 7
const int dir =  4;  //set direction at pin 4

void setup() {
  Serial.begin(9600);           
  pinMode(pul, OUTPUT);
  pinMode(dir, OUTPUT);   
}


void loop(){
  digitalWrite(dir, HIGH);
  digitalWrite(pul, HIGH);
  delayMicroseconds(10);
}

 

Here is the datasheet for the driver.

http://www.cnc4you.co.uk/resources/CW5045.pdf

I hope that the fact that it does do a few steps means it is hooked up right and its just bad code.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A pulse has a start time and a stop time. You are turning the pin on, and leaving it on. Try turning the pin(s) off after the delay.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Paul, that did the trick. Its spinning away happily now!
Logged

Pages: [1]   Go Up
Jump to: