Compiling error

int USF = 1; int USR = 2; int LMF = 3; int LMR = 4;
int RMF = 6; int RMR = 7; int USLS = 9; int USRS = 10; int USSL = 11;
int USSR = 12; int Scan = 13; int BEEP = 0;
void setup() {
  pinMode(USF, INPUT); pinMode(USR, INPUT); pinMode(USLS, INPUT); pinMode(USRS, INPUT);
  pinMode(USSL, INPUT); pinMode(USSR, INPUT); pinMode(Scan, INPUT); pinMode(LMF, OUTPUT);
  pinMode(LMR, OUTPUT); pinMode(RMF, OUTPUT); pinMode(RMR, OUTPUT); pinMode(BEEP, OUTPUT);
}
void loop() {
  digitalWrite(LMF, LOW); digitalWrite(LMR, LOW); digitalWrite(RMF, LOW); digitalWrite(RMR, LOW);
  if (USF == LOW) {
    LMF = HIGH;
    RMF = HIGH;
    BEEP = LOW;
  }
  if (USF == HIGH) {
    LMF = LOW; RMF = LOW;
    if (USR = LOW) {
      LMR = HIGH;
      RMR = HIGH;
      BEEP = HIGH;
    }
    if (USR == HIGH) {
      LMR = LOW; RMR = LOW;
      if (USRS == LOW && USLS == HIGH && USSR == LOW) {
        LMR = LOW;
        RMR = HIGH;
      }
      if (USLS == LOW && USRS == HIGH && USSL == LOW) {
        LMR = HIGH;
        RMR = LOW;
      }
      if (USR == HIGH && USRS == HIGH && USLS = HIGH) {
        LMR = LOW; RMR = LOW; BEEP = HIGH;
      }
    }
  }
}type or paste code here

Error I get when trying to Compile;
Error Compiling for board Arduino UNO

If I remove the lines below, it compiles
if (USR == HIGH && USRS == HIGH && USLS = HIGH) {LMR = LOW; RMR = LOW; BEEP = HIGH;
This line is similar to lines above it. Is there something I'm not seeing?

type or paste code here

Please post your full sketch, using code tags, and the full error message, again using code tags

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming category of the forum

I see a problem. That's all you get for a snippet and no complete error message however.

Thanks, Im still getting use to this Forum. Is there usage info somewhere?

@kc0nfs - figure out what that means and do it.

Before, you might use the IDE Autoformat tool. Although in this case it might not rescue that pile of statements.

a7

I tried, it didn't change anything. Still get the Error message.

Could it be there's too much memory being used?

Do that. Use code tags like you did for the code.

a7

You left off some parentheses and your mistake turned into a real error.

      if (USR == HIGH && USRS == HIGH && (USLS = HIGH)) {

will make the error go away, and leave you only with your mistake.

a7

Thanks all,
I believe I see what I did:
in that last line


if (USR == HIGH && USRS == HIGH && USLS = HIGH){ LMR = LOW; RMR = LOW;BEEP = HIGH;

&& USLS = HIGH ) should be && USLS == HIGH )

It compiled after thatUse code tags to format code for the forum

You might like to adopt the convention of putting each program statement on a new line.

It is the way most code you'll see is written, there is no good reason to save whatever you think you are saving, carriage returns? paper?

In fact, doing it your way makes you a very unproductive programmer, as typically that is measured in lines of code per unit of time, like a day. Think how important that would be if someone were paying you on that basis. :expressionless:

But mostly it's just harder to read, and you want us to have an easy time reading your code, amIright?

a7

You did not even mention what the exact error-message is.

How should somebody help if

  • exact error-message is unknown
  • only a code-snippet is posted

When you joined the forum you were directed to
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
I assume that you did not read it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.