Welcome! Log In Create A New Profile

Advanced

Ardunio sketch advice!

Posted by mrsmith91 
Ardunio sketch advice!
March 18, 2015 09:12AM
I'm wanting to run a sketch on my set up (velleman K8200 printer controlled by Arduino mega, RAMPS 1.4 and pololu A4988 stepper drivers) but not having any joy with it.
I looked at the RAMPS 1.4 test code to get pin definitions.
I wrote this code for it, it verifies fine, but when I upload, nothing happens, the motors don't move at all. I've defined each stepper based on the pins that are on the test code (the original code in the post) and that code works, so the pins must be correct, what is wrong with this then?

#include

//AccelStepper Xaxis(1, 54, 55); // pin 54 = step, pin 55 = direction
//AccelStepper Yaxis(1, 60, 61); // pin 60 = step, pin 61 = direction
//AccelStepper Zaxis(1, 46, 48); // pin 46 = step, pin 48 = direction

AccelStepper Xaxis(1, 54, 55); // pin 54 = step, pin 55 = direction
AccelStepper Yaxis(1, 60, 61); // pin 60 = step, pin 61 = direction
AccelStepper Zaxis(1, 46, 48); // pin 46 = step, pin 48 = direction

void setup() {
Xaxis.setMaxSpeed(400);
Yaxis.setMaxSpeed(400);
Zaxis.setMaxSpeed(400);
Xaxis.setSpeed(45);
Yaxis.setSpeed(25);
Zaxis.setSpeed(80);
}

void loop() {
Xaxis.runSpeed();
Yaxis.runSpeed();
Zaxis.runSpeed();
}
Sorry, only registered users may post in this forum.

Click here to login