Programming a Stepper Motor for Reverse

I used the code below to drive the stepper motor in one direction:

void blindsForward(){

 for (int increment = 0; increment < 56; increment++ ){
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);

}
}

I was under the impression that I could reverse the polarity on one of the coils to reverse the direction of the motor by using the code below:

void blindsBackward(){   //This works by changing the polarity of the second coil only.

   digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);

}

but I am getting movement in the same direction. I followed the coding from this:

I was under the impression that I could reverse the polarity on one of the coils to reverse the direction of the motor by using the code below:

No that is not the way to do it. You reverse the sequence of the coil powering to make it go backwards.

You reverse the sequence of the coil powering to make it go backwards.

Thank you good sir! I'm surprised I haven't tried that. It works, thank you very much.

The code is now as follows for reverse:

void blindsBackward(){                                       //This is done by revesing the sequence of the foward direction

 for (int increment_2 = 0; increment_2 < 56; increment_2++ ){
  digitalWrite(9, HIGH);  //ENABLE CH A
  digitalWrite(8, LOW); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
   
  delay(delaylegnth);
  
  digitalWrite(9, LOW);  //DISABLE CH A
  digitalWrite(8, HIGH); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);
  
  digitalWrite(9, HIGH);  //ENABLE CH A
  digitalWrite(8, LOW); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
    
  digitalWrite(9, LOW);  //DISABLE CH A
  digitalWrite(8, HIGH); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);

}
}

It is possible to reverse the direction of a stepper motor by reversing the polarity of one coil

Example step pattern for 1/2 stepping:

Normal:	 		Reverse Polarity
			of first Coil:
  1 2 3 4		  1 2 3 4
A + 0 - 0		E - 0 + 0 
B + + - -		D - + + -
C 0 + 0 -		C 0 + 0 -
D - + + -		B + + - -
E - 0 + 0		A + 0 - 0
F - - + +		H + - - +
G 0 - 0 +		G 0 - 0 +
H + - - +		F - - + +

Where 1&3 are one coil, 2&4 are the other coil

From the example pattern you can see that by reversing the coil that is 1&3, you reverse the sequence.