Dm452t to arduino tto joystick

Ola, I'm connecting a DM452t to NEMA 23 to Arduino Leonardo to joystick. I can get the data from the joystick but I cannot get the motor to move. I've connected the DM452t to motor black to A+, green to A-, red to B+, and blue B-. My code is:

// Define pins for DM452T Driver
const int stepPin = 5;    // PUL+ for Driver
const int dirPin = 6;     // DIR+ for Driver
const int enablePin = 7;  // ENA+ for Driver (optional)

// Define pin for joystick Y-axis
const int joyYAxis = A1;

// RPM settings
const int rpm = 60;  // Set desired RPM
const int stepsPerRevolution = 200; // Set based on your stepper motor
const int stepDelay = 60000000L / (rpm * stepsPerRevolution); // Calculate delay between steps

// Variables to store joystick value
int joyYValue;

void setup() {
  // Set pin modes for the stepper driver
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  pinMode(enablePin, OUTPUT);

  // Enable the driver (assuming LOW enables the driver)
  digitalWrite(enablePin, LOW);

  // Initialize serial communication for debugging
  Serial.begin(9600);
}

void loop() {
  // Read the value from the joystick Y-axis
  joyYValue = analogRead(joyYAxis);

  // Print joystick value to the serial monitor (for debugging)
  Serial.print("Joystick Y: ");
  Serial.println(joyYValue);

  // Set motor direction based on joystick value
  if (joyYValue > 512) {
    digitalWrite(dirPin, HIGH); // Set direction to forward
  } else {
    digitalWrite(dirPin, LOW); // Set direction to backward
  }

  // Move motor
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(stepDelay);
  digitalWrite(stepPin, LOW);
  delayMicroseconds(stepDelay);

  // Add a small delay before the next loop
  delay(10); // Adjust as needed
}

Any help is much appreciated

did you tryed HIGH ?
show your schematic

I tried that and still nothing
schematic wise:
pul+ to D6, pul- to GND, dir+ to D5, and dir- to GND
joystick A1 VCC and GND to Arduino
all connected through the breadboard
DM452t to separate power source

also i used chatgpt to write this code, and im not using the enable pins

if you not using Enable - disconnect it

show picture

// Define pins for DM452T Driver
const int stepPin = 5;    // PUL+ for Driver
const int dirPin = 6;     // DIR+ for Driver

// Define pin for joystick Y-axis

void setup() {
  // Set pin modes for the stepper driver
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}

void loop() {
  int joyYValue = analogRead(A1) - 511;

  // Set motor direction based on joystick value
  digitalWrite(dirPin, joyYValue > 0); // Set direction to forward

  // Move motor
  if (abs(joyYValue) > 25)digitalWrite(stepPin, !digitalRead(stepPin));

  // Add a small delay before the next loop
  delay(10);
}

i see not motor connected

зображення

separate motor

if you upload your sketch do you see numbers in Serial monitor?

not anymore

another motor connector? why is it in picture at all?

not mine

originally i want 2 motors, but im trying to do one at a time

yes sorry

pls lay it to side and make picture of only necessary wires