Untitled

 avatar
unknown
plain_text
2 months ago
511 B
5
Indexable
// CNC Shield Stepper Control Demo
// Superb Tech
// www.youtube.com/superbtech

const int StepX = 2;
const int DirX = 5;

void setup() {
  pinMode(StepX, OUTPUT);
  pinMode(DirX, OUTPUT);
}

void loop() {
  digitalWrite(DirX, HIGH); // set direction, HIGH for clockwise, LOW for anticlockwise

  for (int x = 0; x < 200; x++) { // loop for 200 steps
    digitalWrite(StepX, HIGH);
    delayMicroseconds(500);
    digitalWrite(StepX, LOW);
    delayMicroseconds(500);
  }
  delay(1000); // delay for 1 second
}
Editor is loading...
Leave a Comment