-2

CODE:

int MS = A0;
int LMF = 12;
int LMR = 13;
int RMF = 11;
int RMR = 10;

void setup() {
  pinMode(LMF, OUTPUT);
  pinMode(RMF, OUTPUT);
  pinMode(LMR, OUTPUT);
  pinMode(RMR, OUTPUT);
  pinMode(MS, INPUT);
}

void loop() {
  int m;
  m = analogRead(MS);
  if (m > 600) {
    digitalWrite(LMF, HIGH);
    digitalWrite(RMF, HIGH);
    digitalWrite(LMR.LOW);
    digitalWrite(RMR, LOW);
  } else {
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);
    digitalWrite(LMR.HIGH);
    digitalWrite(RMR, HIGH);
  }
}

ERROR: Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from sketch\part_2.ino.cpp:1:0:

C:\Users\Amit Dudeja\Documents\Arduino\part_2\part_2.ino: In function 'void loop()':

C:\Users\Amit Dudeja\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.1\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant

#define LOW 0x0

          ^

C:\Users\Amit Dudeja\Documents\Arduino\part_2\part_2.ino:23:20: note: in expansion of macro 'LOW'

digitalWrite(LMR.LOW);

                ^~~

C:\Users\Amit Dudeja\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.1\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant

#define HIGH 0x1

          ^

C:\Users\Amit Dudeja\Documents\Arduino\part_2\part_2.ino:30:20: note: in expansion of macro 'HIGH'

digitalWrite(LMR.HIGH);

                ^~~~

exit status 1 Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

  • 1
    It looks like you accidentally put periods instead of commas. – Paul Jan 2 at 7:11
  • 1
    it is diffucult to miss when the code is properly formatted – jsotola Jan 2 at 7:45
  • 1
    Please close this question as it is just a typo. – the busybee Jan 2 at 8:21
  • 2
    I'm voting to close this question as off-topic because it's o ly about a typo. The question got an answer, but it will not help anyone else. – chrisl Jan 2 at 9:35
1
    digitalWrite(LMR.LOW);

and

    digitalWrite(LMR.HIGH);

Replace the period with a comma.

| improve this answer | |

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