expected primary-expression before '>' token AND ALSO error: 'left' was not de..

SOLVED.

Hi,
that is my code:

#include <Wire.h>
#include <HMC5883L.h>
HMC5883L compass;
char blueToothVal;


void setup() {
  Serial.begin(9600);
  pinMode (13, OUTPUT);
  pinMode (10, OUTPUT);
  pinMode (9, OUTPUT);
  pinMode (7, OUTPUT);
  pinMode (6, OUTPUT);
  compass = HMC5883L();

}

void loop() {
  if (Serial.available())
    blueToothVal = Serial.read();

  MagnetometerRaw raw = compass.ReadRawAxis();
  float heading = atan2(raw.YAxis, raw.XAxis);
  if (heading < 0)
    heading += 2 * PI;
  float headingDegrees = heading * 180 / M_PI;


  if (blueToothVal == 2)
  {
    //North 360
    if (headingDegrees < 350)
      if (headingDegrees < 250)
        Left(1);
      else
        left(0);
    if (headingDegrees > 10)
      if (headingDegrees < 110)
        Right(1);
      else
        Right(0);

  }
  if (blueToothVal == 4)
  {
    //west 90
    if (headingDegrees < 80)
      if (headingDegrees < 360 && headingDegrees > 230)
        Left (1);
      else
        Left (0);
    if (headingDegrees > 100 && headingDegrees < 230)
      if (headingDegrees > 200)
        Right (1);
      else
        Right (0);
  }


  if (blueToothVal == 6)
  {
    if (headingDegrees < 260)
      if (headingDegrees < 160 && headingDegrees => 60)
        Left (1);
      else
        Left (0);
    if (headingDegrees > 280)
      if (headingDegrees > 0 && < 60)
        Right (1);
      else
        Right (0);

  }
  if (blueToothVal == 8)
  {
    // south 180
    if (headingDegrees < 170)
      if (headingDegrees < 100)
        Left (1);
      else
        Left (0);
    if (headingDegrees > 190)
      if (headingDegrees > 290)
        Right (1);
      else
        Right (0);

  }
  delay(300);
}
void Right(int a)
{
  if (a == 0)
  {
    analogWrite (11, 180);
    analogWrite (5, 180);
  }
  else
  {
    analogWrite (11, 255);
    analogWrite (5, 255);
  }
  digitalWrite(6, 0);
  digitalWrite(7, 1);
  digitalWrite(9, 0);
  digitalWrite(10, 1);
}
void Left(int a)
{
  if (a == 0)
  {
    analogWrite (11, 180);
    analogWrite (5, 180);
  }
  else
  {
    analogWrite (11, 255);
    analogWrite (5, 255);
  }
  digitalWrite(6, 1);
  digitalWrite(7, 0);
  digitalWrite(9, 1);
  digitalWrite(10, 0);
}

now there are 2 errors:

back_to_the_direction.ino: In function ‘void loop()’:
back_to_the_direction:37: error: ‘left’ was not declared in this scope
back_to_the_direction:64: error: expected primary-expression before ‘>’ token
back_to_the_direction:69: error: expected primary-expression before ‘<’ token
‘left’ was not declared in this scope

May someone please explame me what I did wrong?
SFBE,
tnks.

Need to put prototypes in, as you call the functions before declaring them. Put these lines above your loop():

void Right(int a);
void Left(int a);

tammytam:
Need to put prototypes in, as you call the functions before declaring them. Put these lines above your loop():

void Right(int a);

void Left(int a);

found the problem, left, !Left, but what with the second problem?

solved! sorry for To bother you :slight_smile:

Need to put prototypes in, as you call the functions before declaring them. Put these lines above your loop():

The IDE adds function prototypes, and even does it correctly most of the time.

     if (headingDegrees < 160 && headingDegrees => 60)

in C==, the operator is >=.

left() is different from Left()

Also:

if (headingDegrees > 0 && < 60)

Second part of that statement is checking nothing is less than 60 :wink: