This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
CONSULTA Error compiladopara la tarjeta Arduino/Genuino Uno
#1
Llevo horas tratando de resolver este problema, pero no encuentro una solución... Este es mi código:
#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);
#include <SoftwareSerial.h>
SoftwareSerial BT1(4,2);
char s='l';
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
BT1.begin(9600);
motor2.setSpeed(250);
motor3.setSpeed(250);
motor4.setSpeed(250);
}
 
void loop() {
  // put your main code here, to run repeatedly:
   BT1.println("Listo");
  if(BT1.available()){
     s=BT1.read();
    Serial.println(s);
   
  }
  delay (1000);
    if(s=='a'){ //Adelante
        motor1.run(FORWARD);
        motor2.run(FORWARD);
        motor3.run(FORWARD);
        motor4.run(FORWARD);
        motor1.setSpeed(240);
        motor2  .setSpeed(240);
        motor3.setSpeed(240);
        motor4.setSpeed(240);
    }
    if(s=='t'){ //Atrás
        motor1.run(BACKWARD);
        motor2.run(BACKWARD);
        motor3.run(BACKWARD);
        motor4.run(BACKWARD);
    }
    if(s=='i'){ //Vuelta a la izquierda
        motor1.run(FORWARD);
        motor2.run(FORWARD);
        motor3.run(RELEASE);
        motor4.run(RELEASE);
    }
    if(s=='d'){ //Vuelta a la derecha
        motor1.run(RELEASE);
        motor2.run(RELEASE);
        motor3.run(FORWARD);
        motor4.run(FORWARD);
    }
      if(s=='r'){ //Detener
        motor1.run(RELEASE);
        motor2.run(RELEASE);
        motor3.run(RELEASE);
        motor4.run(RELEASE);
      }
    
}
  Responder
#2
Y el error? Copia el error que te da el IDE de Arduino.
Saludos
  Responder
#3
Play Pro Evolution Soccer 2018/2019/2020 https://www.pes2019.org/
  Responder
#4
Hola, mira en la línea 30, un espacio que hay despues de motor2

Enviado desde mi Redmi 8 mediante Tapatalk
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  CONSULTA Luces en la tarjeta gt2560 0 662 10-07-2020, 08:23 PM
Último mensaje: Invitado
  CONSULTA error compilando para tarjeta arduino uno cesar noguera 0 694 06-05-2020, 05:34 PM
Último mensaje: cesar noguera