Project number ten does not work

Okay, so I have tried literally everything to make tis project work, but when I press the button that makes the motor spin, nothing happens. I have assembled the circuit a bunch of times but nothing seems to happened , I even went to the store and but a new replacement of the H bridge, because I thought that may be the solution, but nothing happened. Also the program told me that the codes were all right, but anyways here I leave them , I hope someone can help me with this.

const int controlPin1 = 2;
const int controlPin2 = 3;
const int enablePin = 9;
const int directionSwitchPin = 4;
const int onOffSwitchStateSwitchPin = 5;
const int potPin = A0;

int onOffSwitchState = 0;
int previousOnOffSwitchState = 0;
int directionSwitchState = 0;
int previousDirectionSwitchState = 0;

int motorEnabled = 0;
int motorSpeed = 0;
int motorDirection = 1;

void setup() {
// put your setup code here, to run once:
pinMode(directionSwitchPin, INPUT);
pinMode(onOffSwitchStateSwitchPin, INPUT);
pinMode(controlPin1, OUTPUT);
pinMode(controlPin2, OUTPUT);
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, LOW);

void loop() {
// put your main code here, to run repeatedly:
onOffSwitchState =
directionSwitchState =
motorSpeed = analogRead(potPin)/4;
if(onOffSwitchState != previousOnOffSwitchState){
if(onOffSwitchState == HIGH){
motorEnabled = !motorEnabled;
if (directionSwitchState !=
previousDirectionSwitchState) {
if (directionSwitchState == HIGH) {
motorDirection = !motorDirection;
if (motorDirection == 1) {
digitalWrite(controlPin1, HIGH);
digitalWrite(controlPin2, LOW);

else {
digitalWrite(controlPin1, LOW);
digitalWrite(controlPin2, HIGH);
if (motorEnabled == 1) {
analogWrite(enablePin, motorSpeed);
else {
analogWrite(enablePin, 0);
previousDirectionSwitchState =
previousOnOffSwitchState = onOffSwitchState;

Please read the post at the top of each section 'How to use this forum - Please Read'. It contains information that will assist you in getting the best responses from the people who are trying to help you.

Anyway, if you are confident that your code is correct then there must be an error in the way you have connected it together. The code is available in the IDE - File -> Examples -> 10. Starter Kit.