#include
// Stepper motor pins
#define IN1 26
#define IN2 25
#define IN3 33
#define IN4 32
AccelStepper stepper(AccelStepper::HALF4WIRE, IN1, IN3, IN2, IN4);
void setup() {
Serial.begin(115200);
stepper.setMaxSpeed(1000); // slow speed for hitting stopper
stepper.setAcceleration(200);
//code to manually set the 0th position at start up
stepper.setSpeed(1000);
for (int i = 0; i < 100000; i++) {
stepper.runSpeed();
Serial.println("1");
}
stepper.setCurrentPosition(0);
Serial.println("Zero position set!");
stepper.move(50);
stepper.runToPosition();
}
void loop() {
stepper.move(-500);// tried - / + both gave clockwise output
stepper.runToPosition();
}
< /code>
Я попытался поместить отрицательный знак в stepper.move (-x);
попробовал изменить порядок вывода, то есть in1 in2 /in2 in3 /in1 in4
note из методов < /p>
Подробнее здесь: https://stackoverflow.com/questions/797 ... -cw-to-ccw