was not declared in this scope

I am new to the arduino and the C programming language, but not to programming and machine control.

I have been intermittently getting the error (was not declared in this scope). It makes no sense as it stops at the same place every time where I have not made a change. The program as complied many times and have been testing it on a small sawmill. I can make a number of changes everything is fine and then the next time for no reason I will get this error. I can remove the change I made and still get the error. All I can do is to go back to the previous version and add the new code and it will work for a while. Is this some quirk with the compiler ? I have attached my latest file that compiles with this error.

Any help would be greatly appreciated.



Encoder_20E.ino (6.52 KB)

One letter variable names are a bad idea.

One letter global variable names are an even worse idea.

One letter global variables names that are upper case are just plain stupid.

Are you compiling on the same computer every time? For what board? Using what version of the IDE?

You need to post a link to the LCD library you are using.

ASet and Aset are NOT the same name.

If you properly indent your code (run IDE menu tools → auto format), you might see where you go wrong.

Around line 199

if (mode == 2)
  lcd.lcdWrite ("Set 1          ");

The first } in above ends your loop().

Further your code is impossible to read; after a { you should start a new line for the next statement.

Thanks for the quick responses. It all makes sense that I am confusing the compiler. I will clean things up and give it another try.