I have a question in RAMPS 1.4 BOARD TEST CODE!!

Hi, I am using NEMA 17 Stepper motor with Arduino Mega 2560 + RAMPS 1.4 .
I connected just 1 motor (X_motor on RAMPS) and uploaded the test code.
The test code successfully uploaded to Mega and motor rotates for 5 seconds and change direction.

And now I'm trying change code to rotate X_motor with data from the PC.

The variables which is related with X_motor are like below

  1. X_ENABLE_PIN :

  2. X_MIN_PIN :

  3. X_MAX_PIN :

  4. X_DIR_PIN : decides the direction of the rotation

  5. X_STEP_PIN : decides the steps of rotation

I understand the role of X_DIR_PIN & X_STEP_PIN but not X_ENABLE_PIN & X_MIN_PIN & X_MAX_PIN

what are the roles of them? :slight_smile:

I presume the enable pin interacts with the enable input on the stepper driver. Does you RAMPS board have A4988 drivers?

At a guess (but it is no more than that) the min and max pins are for connection to limit switches.

...R

To Robin2

Yes I connected one A4988 Stepper motor driver on X_motor side of RAMPS 1.4 BOARD.

I think that X_MIN & X_MAX are related with limit switch.

If X_ENABLE_PIN's role is that you said,

void setup() {
pinMode(X_STEP_PIN , OUTPUT);
pinMode(X_DIR_PIN , OUTPUT);
pinMode(X_ENABLE_PIN , OUTPUT);
digitalWrite(X_ENABLE_PIN , LOW);
}

Why the test code writes digitalWrite(X_ENABLE_PIN,LOW); at setup()?
What will happen if I change LOW -> HIGH???(I'm worried about bad result like fire in my board haha ~_~;;;:wink:

Setting the enable pin HIGH or LOW won't do any damage.

I believe the A4988 is enabled when the enable pin is LOW - but I have never tested that. On my A4988s I never used that pin.

...R