newbie trouble with a nano and L298n

Hi everyone, hopefully I am improving with my ability to post…not so much on the coding but I’m trying,

It seems like it should be pretty simple to push a button and make a motor turn but it’s not working and I’m a bit stuck. would appreciate a point in the right direction…here is the sketch:

////
//////arduino nano with L298n
//////2 push button with 2 motor
//////push for on, release for off
//////potentiameter speed control
//////
////push button A pin d6
////push button B pin d5
////
////motor 1 enable pin d10
////motor 1 int 1 pin d7
////motor 1 int 2 pin d8
////
////motor 2 enable pin d9
////motor 2 int 3 pin d2
////motor 2 int 4 pin d4
//
//potentiometer pin a1

#define enA 10
#define in1 7
#define in2 8
#define buttonA 6

#define enB 9
#define in3 2
#define in4 4
#define buttonB 5
// Speed control potentiometers

int SpeedControl1 = A1;
int SpeedControl2 = A1;
// Motor Speed Values - Start at zero

int MotorSpeed1 = 0;
int MotorSpeed2 = 0;

void setup() {
  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(buttonA, INPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  pinMode(buttonB, INPUT);

}

void loop() {

  // Set Motor A forward

  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);

  // If button is pressed - turn motor on
  if (buttonA == true) {
    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);
    delay(20);

    // Set Motor B forward

    digitalWrite(in3, LOW);
    digitalWrite(in4, LOW);
    // If button is pressed - turn motor on
   
    if (buttonB == true) {
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      delay(20);
  }
      // Read the values from the potentiometers

      MotorSpeed1 = analogRead(SpeedControl1);
      MotorSpeed2 = analogRead(SpeedControl2);


      // Convert to range of 0-255

      MotorSpeed1 = map(MotorSpeed1, 0, 1023, 0, 255);
      MotorSpeed2 = map(MotorSpeed2, 0, 1023, 0, 255);

      // Adjust to prevent "buzzing" at very low speed

      if (MotorSpeed1 < 8)MotorSpeed1 = 0;

      if (MotorSpeed2 < 8)MotorSpeed2 = 0;


      // Set the motor speeds

      analogWrite(enA, MotorSpeed1);
      analogWrite(enB, MotorSpeed2);


    }

  }

Why do you think this is an installation issue?

TheMemberFormerlyKnownAsAWOL: Why do you think this is an installation issue?

It isn't I just screwed up....is there a way to move it to the programming section?...

      MotorSpeed1 = analogRead(SpeedControl1);
      MotorSpeed2 = analogRead(SpeedControl2);


      // Convert to range of 0-255

      MotorSpeed1 = map(MotorSpeed1, 0, 1023, 0, 255);
      MotorSpeed2 = map(MotorSpeed2, 0, 1023, 0, 255);

      // Adjust to prevent "buzzing" at very low speed

      if (MotorSpeed1 < 8)MotorSpeed1 = 0;

      if (MotorSpeed2 < 8)MotorSpeed2 = 0;


      // Set the motor speeds

      analogWrite(enA, MotorSpeed1);
      analogWrite(enB, MotorSpeed2);


    }

  }

There is an issue here first you are stating that MotorSpeed1 is the analog result of SpeedControl1. Then you trying to do a map function with same variable.

  analogRead(SpeedControl1); // read analog value
  analogRead(SpeedControl2);


      // Convert to range of 0-255

      MotorSpeed1 = map(SpeedControl1, 0, 1023, 0, 255); // map the analog reading to 0-255 and assign to MotorSpeed1

      MotorSpeed2 = map(SpeedControl2, 0, 1023, 0, 255);

      // Adjust to prevent "buzzing" at very low speed

      if (MotorSpeed1 < 8)MotorSpeed1 = 0;

      if (MotorSpeed2 < 8)MotorSpeed2 = 0;


      // Set the motor speeds

      analogWrite(enA, MotorSpeed1);
      analogWrite(enB, MotorSpeed2);


    }

  }