Skip to content

Instantly share code, notes, and snippets.

@azhaganandhan
Created March 22, 2018 11:32
Show Gist options
  • Save azhaganandhan/4d5a07de119c6c6586d0b73186bce341 to your computer and use it in GitHub Desktop.
Save azhaganandhan/4d5a07de119c6c6586d0b73186bce341 to your computer and use it in GitHub Desktop.
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
incomingByte = Serial.read();
if(incomingByte == 'R') {
youStepper.step(stepsPerRevolution);
}
if(incomingByte == 'L') {
myStepper.step(stepsPerRevolution);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment