Moving two stepper with 542 microstepping driver

Hello! I do this code, maybe to someone it helps.

My question is how I declare to move the motor in the other direction.

thanks

#include <AccelStepper.h>

#define AnchoPulso 1000
// The X Stepper pins
#define STEPPER1_DIR_PIN 3
#define STEPPER1_STEP_PIN 2
#define STEPPER1_ENA_PIN 1
// The Y stepper pins
#define STEPPER2_DIR_PIN 7
#define STEPPER2_STEP_PIN 6
#define STEPPER2_ENA_PIN 5
// Define some steppers and the pins the will use
AccelStepper stepper1(AccelStepper::DRIVER, STEPPER1_STEP_PIN, STEPPER1_DIR_PIN);
AccelStepper stepper2(AccelStepper::DRIVER, STEPPER2_STEP_PIN, STEPPER2_DIR_PIN);

//uint8_t   interface = AccelStepper::FULL4WIRE,uint8_t   pin1 = 2,uint8_t   pin2 = 3,uint8_t   pin3 = 4,uint8_t   pin4 = 5,bool  enable = true)   

void setup()
{  
  digitalWrite(STEPPER1_ENA_PIN, LOW);
  digitalWrite(STEPPER2_ENA_PIN, LOW);
  //digitalWrite(STEPPER1_DIR_PIN, HIGH);
    stepper1.setMaxSpeed(1000.0);
    //stepper1.setAcceleration(1000.0);
    stepper1.moveTo(1000);
    stepper1.setSpeed(1000);
    
    stepper2.setMaxSpeed(1000.0);
    //stepper2.setAcceleration(1000.0);
    stepper2.moveTo(-1000);
    stepper2.setSpeed(1000);
}

void loop()
{
    // Change direction at the limits
 
    stepper1.runSpeed();
    stepper2.runSpeed();
    }

You don't understand the principle of operation of the AccelStepper library.

You need to put this code into the body of the loop() function:

  stepper1.run() ;
  stepper2.run() ;

Without this nothing will ever happen.

Then you need to call the various command functions like moveTo() at suitable times, or under
suitable conditions:

  if (stepper1.currentPosition() == 0)
    stepper.moveTo (1000) ;
  else if (stepper1.currentPosition() == 1000)
    stepper.moveTo (0) ;

The library handles the rest for you, so long as you call run() regularly. This means not using delay()
in your code.

Usually you'd set the speed and acceleration once, in setup()

I've never used the AccelStepper library, but I know you can easily reverse direction with the plain old Stepper library. Not sure what your project and application are though, so I can't really help you.