Make a Stepper turn clockwise and anti clockwise in a loop

I’m trying to make a step motor turn clockwise and anti clockwise with an Arduino UNO and a Step motor 28BYJ-48 and its encoder, I’m using Arduino’s code for reference

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

But for some reason, it doesn’t go backwards, what could possibly be happening?

This is the way I wired the circuit

What do you have between the Arduino and the stepper?

That's the code you need, how is it hooked up?

Set the steps per rev to 513 and RPM to 35 or less and try it. Also you may have to swap motor wires around to find a combo that works with stepper library.
Try this simple 4 step sketch without the stepper lib.

/* coilA pin 8 to pin 1 on ULN2003, pin 16 to pink
   coilB     9 to pin 2,                15     yellow
   coilC    10 to pin 3,                14     orange
   coilD    11 to pin 4,                13     blue

   type a number in top of serial monitor for steps per second,
    300 (35 RPM is about max and hit enter.
*/
byte stepNr [4] = {0x01, 0x02, 0x04, 0x08};
byte cntr = 0;
int stepsPerRev = 513, // 512 is not enough, 514 too many
    dlay = 85;

void setup()
{
  Serial.begin(9600);
  DDRB = 0x0F; // set pins 8,9,10,11 to OUTPUT
}

void loop()
{
  PORTB = stepNr[cntr & 0x3] & 0x0F;
  delay(dlay);
  cntr++; // use cntr-- for opposite direction
  if (Serial.available() > 0)
  {
    dlay = 1000 / Serial.parseInt();
    Serial.println(dlay);
  }
}