-1

When this code is uploaded I get an "Error Compiling". Any help is very much appreciated.

#include <MeetAndroid.h>
#define supplyVolts 6
#define motorVolts 5
#define baudRate 57600
// If you are using a General Bluetooth adapter (available on buildcircuit.net), then, it works with 9600bps baud rate
MeetAndroid phone;
int left = 255; // midpoint
int right = 255;
int pwmLeftPin = 3;  1 int pwmRightPin = 11;
int directionLeftPin = 12;
int directionRightPin = 13;
void setup() {
  pinMode(pwmLeftPin, OUTPUT);
  pinMode(pwmRightPin, OUTPUT);
  pinMode(directionLeftPin, OUTPUT);
  pinMode(directionRightPin, OUTPUT);
  setMotors();
  // use the baud rate your bluetooth module is configured to
  Serial.begin(baudRate);
  phone.registerFunction(setLeft, 'l');
  phone.registerFunction(setRight, 'r');
}

void loop() {
  phone.receive();
}

void setLeft(byte ignore, byte count) {
  int value = phone.getInt();
  left = value;
  setMotors();
}

void setRight(byte ignore, byte count) {
  int value = phone.getInt();
  right = value;
  setMotors();
}

void setMotors() {
  int vLeft = abs(left - 255) * motorVolts / supplyVolts;
  int vRight = abs(right - 255) * motorVolts / supplyVolts;
  int dLeft = (left > 255);
  int dRight = (right > 255);
  if (vLeft < 50) {
    vLeft = 0;
  }
  if (vRight < 50) {
    vRight = 0;
  }
  analogWrite(pwmLeftPin, vLeft);
  analogWrite(pwmRightPin, vRight);
  digitalWrite(directionLeftPin, dLeft);
  digitalWrite(directionRightPin, dRight);
}
3
  • Welcome to Arduino Stack Exchange. We hope you find this site useful. In future posts, please format the code using the code formatting markdown (four leading spaces). For help see Markdown help. You should be able to do this by selecting the code and pressing Ctrl+K to have your browser do this for you. On this occasion I see that @jwpat7 has done it for you.
    – Nick Gammon
    Feb 10 '16 at 3:38
  • Where did you get the MeetAndroid library from? It's hard to reproduce your issue if we have to guess at where the libraries are to be found.
    – Nick Gammon
    Feb 10 '16 at 4:16
4

Take a close look at this line. The compiler will not like that as it does not have the right syntax.

int pwmLeftPin = 3;  1 int pwmRightPin = 11;  

Change it to:

int pwmLeftPin = 3;
int pwmRightPin = 11;  

This should at least remove the first issue with your code.

Cheers!

1
  • @Tom Evans if mikael's answer worked, you should press the check mark next to his answer to reward him with some reputation. Apr 26 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.