Please help in programming

Please help. Programming is wrong, but I do not know where to find and solve the error.

The mpu6050 detects the tilt and send by bluetooth (hc-05), to the car telling the movement that the car has to perform.

Command material:
Arduino NANO
HC-05 (Bluetooth)
MPU-6050
Voltage regulator

The sketch (Car command) is as follows:

#include<Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX

const int MPU=0x68;  // I2C address of the MPU-6050
int AcX,AcY,AcZ;

void setup(){

//Comunicação com o acelerometro
 Wire.begin();
 Wire.beginTransmission(MPU);
 Wire.write(0x6B);  // PWR_MGMT_1 register
 Wire.write(0);     // zero para wakes up MPU-6050)
 Wire.endTransmission(true);

 Serial.begin(9600);  //Para Serial Terminal fazer debug e ler valores do acelerometro
 mySerial.begin(38400);  //para envio por Bluetooth

}
void loop(){
 //leitura dos valores do modulo GY-521
 Wire.beginTransmission(MPU);
 Wire.write(0x3B);  //  register 0x3B (ACCEL_XOUT_H)
 Wire.endTransmission(false);
 Wire.requestFrom(MPU,14,true);
 AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
 AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
 AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)

 //compara os valores obtidos do acelerometro, executa a função pretendida
 if ((AcX/1000)<-5) {Serial.println("Tras");     mySerial.print("b");} else
 if ((AcX/1000)>5)  {Serial.println("Frente");   mySerial.print("f");}  else
 if ((AcZ/1000)<-5) {Serial.println("Esquerda"); mySerial.print("l");} else
 if ((AcZ/1000)>5)  {Serial.println("Direita");  mySerial.print("r");} else mySerial.print("S");
 delay(5);

//debug
// Serial.print(AcY/1000);
// Serial.print(" ");
// Serial.print(AcX/1000);
// Serial.print(" ");
// Serial.println(AcZ/1000);
// delay(1000);

}

Car material:
Arduino UNO
Driver Motor Ponte H L298N
HC-05

And the sketch (car) is as follows:

// Portas para comunicação RX, TX PARA O ARDUIN
char state; //para guardar o valor recebido por bluetooth
///////declaração de saidas para os reles para controlo de mov de motores dc /
int MTR0 = 2; //saida para o relé 0
int MTR1 = 3; //saida para o relé 1
int MTR2 = 7; //saida para o relé 2
int MTR3 = 8; //saida para o relé 3
//
void setup() {
// inicializa as portas Serial para o terminal e para o bluetooth para iniciar
Serial.begin(9600);
pinMode(MTR0, OUTPUT);
pinMode(MTR1, OUTPUT);
pinMode(MTR2, OUTPUT);
pinMode(MTR3, OUTPUT);

// declara o estado inicial das portas de saida
digitalWrite(MTR0,HIGH);
digitalWrite(MTR1,HIGH);
digitalWrite(MTR2,HIGH);
digitalWrite(MTR3,HIGH); }
void loop() {
if (Serial.available()) {
// SE comunicaçao disponivel
state = Serial.read();// le o valor recebido pelo bluetooth,
// direita /////////////////////////////////////////
if (state == 'F' || state == 'f') {
digitalWrite(MTR0,LOW);
digitalWrite(MTR1,HIGH);
digitalWrite(MTR2,HIGH);
digitalWrite(MTR3,LOW); }
// esquerda /////////////////////////////////////////
if (state == 'B' || state == 'b') {
digitalWrite(MTR0,HIGH);
digitalWrite(MTR1,LOW);
digitalWrite(MTR2,LOW);
digitalWrite(MTR3,HIGH); }
// frente /////////////////////////////////////////
if (state == 'R' || state == 'r') {
digitalWrite(MTR0,LOW);
digitalWrite(MTR1,HIGH);
digitalWrite(MTR2,LOW);
digitalWrite(MTR3,HIGH); }
// tras /////////////////////////////////////
if (state == 'L' || state == 'l') {
digitalWrite(MTR0,HIGH);
digitalWrite(MTR1,LOW);
digitalWrite(MTR2,HIGH);
digitalWrite(MTR3,LOW); }
// PARAR/////////////////////////////////////////
if (state == 'S' || state == 'w') {
digitalWrite(MTR0,LOW);
digitalWrite(MTR1,LOW);
digitalWrite(MTR2,LOW);
digitalWrite(MTR3,LOW); }

delay(100);
}

scooby99_pt:
Programming is wrong,

That does not provide any information that would provide a basis for helping you.

Also please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum Your code is too long for me to study quickly without copying to a text editor.

…R