Question: I have some errors in the code below. Can you help me fix them, please? #include #include #include #include Adafruit_MotorShield AFMS = Adafruit_MotorShield () ;

I have some errors in the code below. Can you help me fix them, please?

#include #include #include #include

Adafruit_MotorShield AFMS = Adafruit_MotorShield () ;

int bluetoothTx = 18; //transmit TX1 pin bluetooth mate, arduino D2 int bluetoothTx = 19; //receive RX1 pin bluetooth mate, arduino D3 int index = 0; //defines variable index char message[256]; //defines character message, array of 56 characters

//creates pointers to motor objects Motor *1fMotor; Motor *rfMotor; Motor *lrMotor; Motor *rrMotor; //Adafruit_BLE *ble

void setup () { // put your setup code here, to run once:

Serial.begin(9600); //begin the serial monitor at 9600 bps Serial1.begin (115200); //the bluetooth rate default to 115200 bps

// initialize motor shield with the default frequency of 1.6kHz AFMS.begin ();

//motors mapping and configuration on the robot //motor1 - left front, motor2 - right rear, motor3 - rightfront, motor4 - left rear? lrMotor = new Motor (&AFMS, 1, 0); lrMotor = new Motor (&AFMS, 2, 0); lrMotor = new Motor (&AFMS, 3, 0); lrMotor = new Motor (&AFMS, 4, 0); }

void loop() {

char message [256]; if{serial1.available ()) //if bluetooth sent any characters { message [index] = (char) serial1.read(); //add the character to the message buffer

if (message[index]== 0x3f) { //check for ? character message [index+1] = \0; //add the null character to message

//TANK DRIVE using Bluetooth and cell phone app

if {!strcmp (mesage, bl?)) { lfMotor->setDrive(198, FORWARD); lrMotor->setDrive(198, FORWARD); rrMotor->setDrive(198, FORWARD); rfMotor->setDrive(198, FORWARD); } else if (!strcmp(message, b2?)) { lfMotor->setDrive(155, BACKWARD); lrMotor->setDrive(155, BACKWARD); rrMotor->setDrive(155, BACKWARD); rfMotor->setDrive(155, BACKWARD); } else if (!strcmp(message, b3?)) { lfMotor->setDrive(198, FORWARD); lrMotor->setDrive(198, FORWARD); rrMotor->setDrive(198, BACKWARD); rfMotor->setDrive(198, BACKWARD); } else if (!strcmp(message, b4?)) { lfMotor->setDrive(198, BACKWARD); lrMotor->setDrive(198, BACKWARD); rrMotor->setDrive(198, FORWARD); rfMotor->setDrive(198, FORWARD); } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!