Running a stepper motor with arduino on RAMPS with drv8825 driver

#include <Stepper.h>

int enablePin = 24;
int dirPin = 28;
int stepPin = 26;

void setup() {
  pinMode(enablePin, OUTPUT);
  digitalWrite(enablePin, LOW);
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);

void step(boolean dir, int steps)
  digitalWrite(dirPin, dir);

  for( int i=0;i<steps;i++)
    digitalWrite(stepPin, HIGH);
    digitalWrite(stepPin, LOW);


void loop() {
  step(true, 1000);
  step(false, 1000);

About PraveenMax
My Interests: ------------------ Programming , Drawing & Music

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: