Go Down

Topic: Help getting Stepper Driver going? (Read 728 times) previous topic - next topic

Chems

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: [Select]

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.

PaulS

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.

Chems

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

Go Up