// Forum: https://forum.arduino.cc/t/nema-17-with-l298n-driver-making-a-lot-of-noise/1188178/
// This Wokwi project: https://wokwi.com/projects/381172986564524033
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup()
{
myStepper.setSpeed(100);
Serial.begin(9600);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
digitalWrite(7, HIGH);
digitalWrite(6, HIGH);
Serial.println("clockwise");
myStepper.step(200);
myStepper.step(200);
myStepper.step(-200);
myStepper.step(-200);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
delay(2000);
}