#define DIR 0 // PA2 #define STEP 1 // PA3 #define M1 2 // PA6 int rotation = 0; int steps = 0; int x = 0; void setup() { pinMode(DIR, OUTPUT); pinMode(STEP, OUTPUT); pinMode(M1, OUTPUT); pinMode(10,OUTPUT); digitalWrite(DIR, LOW); digitalWrite(M1, HIGH); digitalWrite(10,HIGH); } int delayus = 200; int changetimer = 0; void loop() { directionMove(0); stepperMove(16400); delay(1000); directionMove(1); stepperMove(16400); exit(0); } void stepperMove(int steps) { for (int j = 0; j < steps; j++){ digitalWrite(STEP, HIGH); delayMicroseconds(delayus); digitalWrite(STEP, LOW); delayMicroseconds(delayus); } } void directionMove(int rotation){ if (rotation == 0){ digitalWrite(0, LOW); digitalWrite(10,LOW); } if (rotation == 1){ digitalWrite(0, HIGH); } }