Making Two Actuators work with 4 Different Buttons - primary expression

Here is my total code: (it controls two motors which work fine and two actuators with four buttons (one to actuate and one to retract for both) it is saying in the highlighted line below that it "expected primary-expression before '>' token"

not sure what it wants.

if I did something incorrectly while posting this I apologize in advance. Still learning.

 /*  Arduino DC Motor Control - PWM | H-Bridge | L298N
         Example 02 - Arduino Robot Car Control
    by Dejan Nedelkovski, www.HowToMechatronics.com
*/
#define enA 9
#define in1 4
#define in2 5
#define enB 10
#define in3 6
#define in4 7

#define enAb 3
#define in1b 2
#define in2b 8
#define enBb 11
#define in3b 12
#define in4b 13

const int button1 = A2;
const int button2 = A3;
const int button3 = A4;
const int button4 = A5;

int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;

int motorSpeedA = 0;
int motorSpeedB = 0; 

void setup() {
    pinMode(enA, OUTPUT);
    pinMode(enB, OUTPUT);
    pinMode(in1, OUTPUT);
    pinMode(in2, OUTPUT);
    pinMode(in3, OUTPUT);
    pinMode(in4, OUTPUT);
    pinMode(enAb, OUTPUT);
    pinMode(enBb, OUTPUT);
    pinMode(in1b, OUTPUT);
    pinMode(in2b, OUTPUT);
    pinMode(in3b, OUTPUT);
    pinMode(in4b, OUTPUT);
    
    // initializing the pushbuttons as an input // 
    pinMode(button1, INPUT);
    pinMode(button2, INPUT);
    pinMode(button3, INPUT);
    pinMode(button4, INPUT);
}
void loop() {
  int xAxis = analogRead(A0); // Read Joysticks X-axis
  int yAxis = analogRead(A1); // Read Joysticks Y-axis
  // Y-axis used for forward and backward control
  if (yAxis < 470) {
    // Set Motor A backward
    digitalWrite(in1, HIGH);
    digitalWrite(in2, LOW);
    // Set Motor B backward
    digitalWrite(in3, HIGH);
    digitalWrite(in4, LOW);
    // Convert the declining Y-axis readings for going backward from 470 to 0 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(yAxis, 470, 0, 0, 255);
    motorSpeedB = map(yAxis, 470, 0, 0, 255);
  }
  else if (yAxis > 550) {
    // Set Motor A forward
    digitalWrite(in1, LOW);
    digitalWrite(in2, HIGH);
    // Set Motor B forward
    digitalWrite(in3, LOW);
    digitalWrite(in4, HIGH);
    // Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorSpeedA = map(yAxis, 550, 1023, 0, 255);
    motorSpeedB = map(yAxis, 550, 1023, 0, 255);
  }
  // If joystick stays in middle the motors are not moving
  else {
    motorSpeedA = 0;
    motorSpeedB = 0;
  }
  // X-axis used for left and right control
  if (xAxis < 470) {
    // Convert the declining X-axis readings from 470 to 0 into increasing 0 to 255 value
    int xMapped = map(xAxis, 470, 0, 0, 255);
    // Move to left - decrease left motor speed, increase right motor speed
    motorSpeedA = motorSpeedA - xMapped;
    motorSpeedB = motorSpeedB + xMapped;
    // Confine the range from 0 to 255
    if (motorSpeedA < 0) {
      motorSpeedA = 0;
    }
    if (motorSpeedB > 255) {
      motorSpeedB = 255;
    }
  }
  if (xAxis > 550) {
    // Convert the increasing X-axis readings from 550 to 1023 into 0 to 255 value
    int xMapped = map(xAxis, 550, 1023, 0, 255);
    // Move right - decrease right motor speed, increase left motor speed
    motorSpeedA = motorSpeedA + xMapped;
    motorSpeedB = motorSpeedB - xMapped;
    // Confine the range from 0 to 255
    if (motorSpeedA > 255) {
      motorSpeedA = 255;
    }
    if (motorSpeedB < 0) {
      motorSpeedB = 0;
    }
  }
  // Prevent buzzing at low speeds (Adjust according to your motors. My motors couldn't start moving if PWM value was below value of 70)
  if (motorSpeedA < 70) {
    motorSpeedA = 0;
  }
  if (motorSpeedB < 70) {
    motorSpeedB = 0;
  }
  analogWrite(enA, motorSpeedA); // Send PWM signal to motor A
  analogWrite(enB, motorSpeedB); // Send PWM signal to motor B









 

// problems: buttonState, placement of buttons //



// connecting the buttons to the arduino is now above ^ // 

// check if the pushbutton is pressed //

[code]if (analogRead(button1) => 500) {
    buttonState1 = HIGH;
}

else if (analogRead(button2) => 500) {
    buttonState2 = HIGH;
}

else if (analogRead(button3) => 500) {
    buttonState3 = HIGH;
}

else if (analogRead(button4) => 500) {
    buttonState4 = HIGH;
}

else ( (buttonState1 < 50) && ( buttonState2 < 50) ) {
    analogWrite(enAb, 0); // How to send speed
}
  
else ( (buttonState3 < 50) && ( buttonState4 < 50) ) {
    analogWrite(enBb, 0); // How to send speed
}


if (buttonState1 == HIGH) { //change buttonState to LOW if its backwards // 
    digitalWrite(in1b, HIGH);
    digitalWrite(in2b, LOW); 
    analogWrite(enAb, 255);
}

if (buttonState2 == HIGH) {
    digitalWrite(in1b, LOW);
    digitalWrite(in2b, HIGH);
    analogWrite(enAb, 255);
}

if (buttonState3 == HIGH) {
    digitalWrite(in3b, HIGH);
    digitalWrite(in4b, LOW);
    analogWrite(enBb, 255);
}

if (buttonState4 == HIGH) {
    digitalWrite(in3b, LOW);
    digitalWrite(in4b, HIGH);
    analogWrite(enBb, 255);
}

}

}

Replace all '=>' with '>='.

Thank you! Could you also possible help with understanding why it only controls one actuator at a time?

What do you mean by "actuator"? You have four motors and the first two seem to be the left and right wheels. Are the other two the actuators?

I think part of the problem is where you compare 'buttonStateX' to 50 when 'buttonStateX' is 0 when initialized and changes to 1 (HIGH) when the corresponding button is first pushed. The values never go back to 0.

Note: You can use 'digitalRead()' on analog inputs 0-5. This will take care of the problem where your button states never go back to 0. Do your button inputs have external pull-up or pull-down resistors? They should if you are using pinMode INPUT.

You will probably want to stop the actuator motors when the buttons are no longer being pressed. Something like this:

/*  Arduino DC Motor Control - PWM | H-Bridge | L298N
         Example 02 - Arduino Robot Car Control
    by Dejan Nedelkovski, www.HowToMechatronics.com
*/
#define enA 9
#define in1 4
#define in2 5
#define enB 10
#define in3 6
#define in4 7


#define enAb 3
#define in1b 2
#define in2b 8
#define enBb 11
#define in3b 12
#define in4b 13


const byte Button1Pin = A2;
const byte Button2Pin = A3;
const byte Button3Pin = A4;
const byte Button4Pin = A5;


bool ButtonPressed1 = false;
bool ButtonPressed2 = false;
bool ButtonPressed3 = false;
bool ButtonPressed4 = false;


int motorSpeedA = 0;
int motorSpeedB = 0;


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


  pinMode(enAb, OUTPUT);
  pinMode(enBb, OUTPUT);
  pinMode(in1b, OUTPUT);
  pinMode(in2b, OUTPUT);
  pinMode(in3b, OUTPUT);
  pinMode(in4b, OUTPUT);


  // initializing the pushbuttons as an input //
  pinMode(Button1Pin, INPUT_PULLUP);
  pinMode(Button2Pin, INPUT_PULLUP);
  pinMode(Button3Pin, INPUT_PULLUP);
  pinMode(Button4Pin, INPUT_PULLUP);
}


void loop()
{
// ...

  // check if the pushbutton is pressed //
  ButtonPressed1 = digitalRead(Button1Pin);
  ButtonPressed2 = digitalRead(Button2Pin);
  ButtonPressed3 = digitalRead(Button3Pin);
  ButtonPressed4 = digitalRead(Button4Pin);




  if (ButtonPressed1 == HIGH)   //change ButtonPressed to LOW if its backwards //
  {
    digitalWrite(in1b, HIGH);
    digitalWrite(in2b, LOW);
    analogWrite(enAb, 255);
  }
  else if (ButtonPressed2 == HIGH)
  {
    digitalWrite(in1b, LOW);
    digitalWrite(in2b, HIGH);
    analogWrite(enAb, 255);
  }
  else
    analogWrite(enAb, 0);


  if (ButtonPressed3 == HIGH)
  {
    digitalWrite(in3b, HIGH);
    digitalWrite(in4b, LOW);
    analogWrite(enBb, 255);
  }
  else if (ButtonPressed4 == HIGH)
  {
    digitalWrite(in3b, LOW);
    digitalWrite(in4b, HIGH);
    analogWrite(enBb, 255);
  }
  else
    analogWrite(enBb, 0);
}