Heyaa was looking for some coding help - I'm trying to create a code for an Arduino nano to push a bipolar stepper motor one full rotation clockwise every 2 seconds. I have a breadboard and L239 H bridge , and the stepper motor is a NEMA 17. i had got it to work on an Arduino UNO and motor shield with my code, but now inputting the code into an Arduino nano does nothing. I would really appreciate any advice, I'm stubborn and refuse to AI generate the code for ethics reasons but i know so little about coding lol, so any help would be really appreciated - the code i found that worked originally is this:
#include <Stepper.h>
const int stepsPerRevolution = 200;// 1.8degree angle stepper, 360 / 1.8 = 200
#define pwmA 3
#define pwmB 11
#define brakeA 9
#define brakeB 8
#define dirA 12
#define dirB 13
Stepper myStepper = Stepper(stepsPerRevolution, dirA, dirB);
void setup(){
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);
Serial.begin(9600);
myStepper.setSpeed(60);
}
void loop() {
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(2000);
}