diff --git a/lib/A4988_Stepper/src/A4988_Stepper.cpp b/lib/A4988_Stepper/src/A4988_Stepper.cpp index 5d723195d..cbd72390a 100644 --- a/lib/A4988_Stepper/src/A4988_Stepper.cpp +++ b/lib/A4988_Stepper/src/A4988_Stepper.cpp @@ -14,7 +14,7 @@ Drives a bipolar motor, controlled by A4988 stepper driver circuit */ - +// #include "Arduino.h" #include "A4988_Stepper.h" A4988_Stepper::A4988_Stepper( int m_spr @@ -60,35 +60,16 @@ void A4988_Stepper::adjustPins(void) { void A4988_Stepper::adjustMicrosteps() { if ((motor_ms1_pin<99)&&(motor_ms2_pin<99)&&(motor_ms3_pin<99)) { - switch (motor_MIS){ - case 1: - digitalWrite(motor_ms1_pin, LOW); - digitalWrite(motor_ms2_pin, LOW); - digitalWrite(motor_ms3_pin, LOW); - break; - case 2: - digitalWrite(motor_ms1_pin, HIGH); - digitalWrite(motor_ms2_pin, LOW); - digitalWrite(motor_ms3_pin, LOW); - break; - digitalWrite(motor_ms1_pin, LOW); - digitalWrite(motor_ms2_pin, HIGH); - digitalWrite(motor_ms3_pin, LOW); - case 4: - digitalWrite(motor_ms1_pin, HIGH); - digitalWrite(motor_ms2_pin, HIGH); - digitalWrite(motor_ms3_pin, LOW); - break; - case 8: - digitalWrite(motor_ms1_pin, LOW); - digitalWrite(motor_ms2_pin, LOW); - digitalWrite(motor_ms3_pin, HIGH); - break; - case 16: - digitalWrite(motor_ms1_pin, HIGH); - digitalWrite(motor_ms2_pin, HIGH); - digitalWrite(motor_ms3_pin, HIGH); - break; + unsigned short i = 0; + while (i < 5){ + if (motor_MIS & (1<