Wireless Communication Lag

I'm following this tutorial (Arduino Project Hub) to build a robot controlled by a PS2 controller. The two arduinos communicate via HC-12 wireless modules. I'm getting some serious lag somewhere making the robot useless. If I press buttons for 2 seconds or less, everything is fine. But if I hold them down, the robot keeps going for a long time after I release the button. I've added some println comments to troubleshoot and the issue doesn't appear to be happening in the transmitter arduino. It seems to be either in the wireless communication or the receiver arduino. The only major modification I made to the tutorial is that we bought cheap clone PS2 controller and the joysticks don't work (instead of 0, 128, 255 they are 0, 0, 255 so they don't detect up or left movement). Now that I watch the video on the tutorial page, it seems to have some lag as well.

What can I do?

Here is the code. First time posting code, so forgive me if it doesn't come through well.

Transmitter Arduino:

#include <PS2X_lib.h>

#include<SoftwareSerial.h>
SoftwareSerial mySerial(6,7);  //HC-12 tx pin, rx pin
PS2X ps2x;
void setup() {
  ps2x.config_gamepad(5,4,3,2, false, false);      //GamePad(clock, command, attention, data, Pressures?, Rumble?)
  Serial.begin(9600);   
  mySerial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
}
void moveForward(){
    mySerial.println("1");
    Serial.println("FORWARD");
  }
void moveBackward(){
    mySerial.println("2");
    Serial.println("BACKWARD");
  }
void turnRight(){
    mySerial.println("3");
    Serial.println("RIGHT");
  }
void turnLeft(){
    mySerial.println("4");
    Serial.println("left");
  }
void turnClockwise(){
    mySerial.println("5");
    Serial.println("clock");
  }
void turnAnticlockwise(){
    mySerial.println("6");
    Serial.println("anticlock");
  }
  void moveServo(){
    mySerial.println("6");
    Serial.println("Servo");
  }
void loop() {
ps2x.read_gamepad();

if(ps2x.Button(PSB_PAD_DOWN)){
    moveBackward();
  } 
if(ps2x.Button(PSB_PAD_UP)){
    moveForward(); //turn off left motor
  }
if(ps2x.Button(PSB_RED)){
    turnClockwise();
  }
if(ps2x.Button(PSB_PINK)){
    turnAnticlockwise();
  }
  if(ps2x.Button(PSB_R1)){
    moveServo();
  }
}

Receiver Arduino:

#include<SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);  //HC-12 tx pin, rx pin
int in1=4, in2=5, in3=6, in4=7; //Motor driver pins

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}
void moveForward(){
      digitalWrite(in1, LOW);
      digitalWrite(in2, HIGH);
      digitalWrite(in3, LOW);
      digitalWrite(in4, HIGH);
  }
void moveBackward(){
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);
  }
void moveLeft(){
      digitalWrite(in1, LOW); 
      digitalWrite(in2, LOW);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);
  }

void moveRight(){
      digitalWrite(in1, HIGH); 
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, LOW);
  }
void clockwise(){      
      digitalWrite(in1, LOW);
      digitalWrite(in2, HIGH);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);
}
void anticlockwise(){      
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, HIGH);
}
void loop() {
  
  if(mySerial.available()>0){
          int input = mySerial.read();
          if(input=='1'){
          Serial.println("FORWARD1");
          moveForward();
        }
      if(input=='2'){
          Serial.println("BACKWARD1");
          moveBackward();
        }
      if(input=='3'){
          Serial.println("RIGHT1");
          moveRight();
        }
      if(input=='4'){
          Serial.println("LEFT1");
          moveLeft();
        }
      if(input=='5'){
          Serial.println("CLOCKWISE");
          clockwise();
        }
      if(input=='6'){
          Serial.println("ANTICLOCKWISE");
          anticlockwise();
        }
  delay(190);
  }   
       else{ 
        digitalWrite(in1, LOW);
          digitalWrite(in2, LOW);
          digitalWrite(in3, LOW);
          digitalWrite(in4, LOW);
       } 

}

Thanks in advance!

You should send one value when a switch BECOMES pressed and another when the switch BECOMES released. You should NOT send values as long as a key IS pressed.

I think I know what you're saying. But I'm just an assistant principal trying to help out some middle school kids, so I'm no expert. Is this how I would do that?

Set up a variable to hold the status of the button. Compare the current button status to the value in the variable. If they are the same, do nothing. If they are different, send the new number.

something like this pseudo code:

void loop(){
y =0;
x = ps2x.read_gamepad();
while (x != y){

Put all of the if statements here

y = x;
}}

How would I change the receiver code to make it keep doing the same thing until it receives a different message?

something like this pseudo code:

Something like that, yes, but with an if statement, NOT a while statement. And y needs to be global or static. Otherwise, it is not the previous state of anything.

The state change detection example shows a real example. That it involves physical switches is not relevant. The same philosophy applies to any kind of value that can change.

How would I change the receiver code to make it keep doing the same thing until it receives a different message?

I really don't understand the question. If you send 'A' when the go switch is pressed, and 'B' when it is released. the receiver should start the car moving when it gets an 'A' and stop it when it gets a 'B'. It doesn't need to "keep doing the same thing". It should do something when it gets a letter. That something shouldn't stop until the corresponding "stop doing that" letter arrives.