Duda control de auto a escala mediante modulo bluetooth

Hola, me encontraba realizando un modelo a escala de un auto 4x4 mediante una tarjeta arduino uno y un modulo puente H L293d, pero al momento de realizar el código me aparece este error
exit status 1
Error compilando para la tarjeta Arduino Uno.

El código es el siguiente:

#include <AFMotor.h>
#include <SoftwareSerial.h>

SoftwareSerial BT1 (9, 10);

AF_DCMotor motorUno(1, MOTOR12_64KH);
AF_DCMotor motorDos(1, MOTOR12_64KH);
AF_DCMotor motorTres(1, MOTOR34_64KH);
AF_DCMotor motorCuatro(1, MOTOR34_64KH);

char dato;

void setup() {
  BT1.begin(9600);
  motorUno.setSpeed(255);
  motorDos.setSpeed(255);
  motorTres.setSpeed(255);
  motorCuatro.setSpeed(255);

}

void loop() {
  if (BT1.available() > 0){
    dato = BT1.read();
  }

  switch (dato){
    
    case "G":
    adelante();
    break;

    case"H":
    Izquierda();
    break;

    case"J":
    Derecha();
    break;

    case "I":
    Alto();
    break;

    case "K":
    Reversa();
    break;

    default:
    Alto();
    break;
  }

}

void Adelante() {
  motorUno.run(FORWARD);
  motorDos.run(FORWARD);
  motorTres.run(FORWARD);
  motorCuatro.run(FORWARD);

}

void Reversa() {
  motorUno.run(BACKWARD);
  motorDos.run(BACKWARD);
  motorTres.run(BACKWARD);
  motorCuatro.run(BACKWARD);
}

void Derecha() {
  motorUno.run(FORWARD);
  motorDos.run(BACKWARD);
  motorTres.run(FORWARD);
  motorCuatro.run(BACKWARD);
}

void Izquierda() {
  motorUno.run(BACKWARD);
  motorDos.run(FORWARD);
  motorTres.run(BACKWARD);
  motorCuatro.run(FORWARD);
}

void Alto() {
  motorUno.run(RELEASE);
  motorDos.run(RELEASE);
  motorTres.run(RELEASE);
  motorCuatro.run(RELEASE);
}

¿Solamente eso te informa, antes no informa nada?

Tienes errores de sintaxis, algo que con paciencia podrías haber resuelto por tu cuenta.

Ejemplo:

Los case no se identifican con "K" sino como caracteres 'K'
Todos terminan con : no con ;

Los prodimientos si se escriben con mayúscula como Adelante() se respeta de ese modo.

Las constantes son MOTOR12_64KHZ no MOTOR12_64KH

#include <AFMotor.h>
#include <SoftwareSerial.h>

SoftwareSerial BT1 (9, 10);

AF_DCMotor motorUno(1, MOTOR12_64KHZ);
AF_DCMotor motorDos(1, MOTOR12_64KHZ);
AF_DCMotor motorTres(1, MOTOR34_64KHZ);
AF_DCMotor motorCuatro(1, MOTOR34_64KHZ);

char dato;

void setup() {
  BT1.begin(9600);
  motorUno.setSpeed(255);
  motorDos.setSpeed(255);
  motorTres.setSpeed(255);
  motorCuatro.setSpeed(255);

}

void loop() {
  if (BT1.available() > 0){
    dato = BT1.read();
  }

  switch (dato){
   
    case 'G':
              Adelante();
              break;

    case 'H':
              Izquierda();
              break;

    case 'J':
              Derecha();
              break;

    case 'I':
              Alto();
              break;

    case 'K':
              Reversa();
              break;

    default:
              Alto();
              break;
  }

}

void Adelante() {
  motorUno.run(FORWARD);
  motorDos.run(FORWARD);
  motorTres.run(FORWARD);
  motorCuatro.run(FORWARD);

}

void Reversa() {
  motorUno.run(BACKWARD);
  motorDos.run(BACKWARD);
  motorTres.run(BACKWARD);
  motorCuatro.run(BACKWARD);
}

void Derecha() {
  motorUno.run(FORWARD);
  motorDos.run(BACKWARD);
  motorTres.run(FORWARD);
  motorCuatro.run(BACKWARD);
}

void Izquierda() {
  motorUno.run(BACKWARD);
  motorDos.run(FORWARD);
  motorTres.run(BACKWARD);
  motorCuatro.run(FORWARD);
}

void Alto() {
  motorUno.run(RELEASE);
  motorDos.run(RELEASE);
  motorTres.run(RELEASE);
  motorCuatro.run(RELEASE);
}

Algo mas, siempre que uses una librería indica de donde la extragiste y como se llama si esta en el Administrador de Librerias o el link en GitHub pero es importante para no adivinar.

De todos modos, bien porque posteastea debidamente tu problema.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.