Stepper Code for Mega/Ramps1.4/Pololu A4988

Hi all,

I need help to code a stepper using the following hardware;

Arduino Mega 256/Ramps1.4/Pololu A4988

The stepper is powered externally by 12v 3amps

The stepper & Pololu A4988 (driver) has been slotted to the X plane on the Ramps 1.4 board

Problem: I cannot get any signal to the stepper. When I check power from the -neg external power input to the +A4988 pot adjuster the max V that I can dial is at 1.2v so that itself may be any issue?

Not sure if it is the code or the hardware.

I have attached a PDF that shows my setup

// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20; // microseconds
int millisbetweenSteps = 25; // milliseconds

void setup() {

Serial.begin(9600);
Serial.println(“Starting StepperTest”);
digitalWrite(ledPin, LOW);

delay(2000);

pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(ledPin, OUTPUT);

digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
digitalWrite(stepPin, LOW);

delay(millisbetweenSteps);

digitalWrite(ledPin, !digitalRead(ledPin));
}

delay(3000);

digitalWrite(directionPin, LOW);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
// delayMicroseconds(pulseWidthMicros); // probably not needed
digitalWrite(stepPin, LOW);

delay(millisbetweenSteps);

digitalWrite(ledPin, !digitalRead(ledPin));
}
}

void loop() {
}

150204 Mega_Ramps1.4_A4988.pdf (244 KB)

Any similar problems out in the Arduino world???

Any similar problems out in the Arduino world???

With people ignoring advice in one thread, and starting another? Yes. It happens far too often.

hey its Paul again. Are you in it for just the cheap shots so to boost your posts clicks? get a life!

I recognize the code so I had better not complain about it :)

Your photos don't provide any useful information I'm afraid.

Are you sure these are the correct pins for the A4988 that you are testing

byte directionPin = 9;
byte stepPin = 8;

This depends on how the Ramps board connects the Arduino to the A4988 and I have no idea about that. If there is a schematic for the RAMPS board you are using perhaps you can post a link to it.

...R

PS -- I have just realized I have been wasting my time on this Thread - I am 110% with @PaulS

Hi,

I started another thread as I read that its best to write a thread for any new topic. I'm having problems with coding the above matter and I'm waiting for some help. If that an issue for you well sorry to have wasted your time.