#include const int nominalStepsPerRevolution = 2048; const byte in1 = 8, in2 = 9, in3 = 10, in4 = 11; Stepper motor(nominalStepsPerRevolution, in1, in3, in2, in4); void releaseCoils() { digitalWrite(in1, LOW); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, LOW); } void setup() { Serial.begin(9600); motor.setSpeed(5); releaseCoils(); Serial.println("Send f or r for 256 steps"); } void loop() { if (Serial.available() > 0) { const char command = Serial.read(); if (command == 'f' || command == 'r') { motor.step(command == 'f' ? 256 : -256); releaseCoils(); Serial.println("Move finished; coils released"); } } }