Arduino IDE: Error: expected `}' at end of input

Hi everyone,

Just to tell you first: I’m using a Teensy 2.0 with a 12" resistive touch panel.
I get a problem when I try to compile my code, and the error is: expected `}’ at end of input.
I’ve checked the parts that I recently added/changed, tried to fix them, but nothing.
My code is really long so I had to attach a file, sorry.

Thanks in advance!

Touch_Keys.ino (13.8 KB)

Line 820 is my guess:

  if(Space==2){
    Keyboard.set_key1(KEY_BACKSPACE);
    Keyboard.send_now();
    Keyboard.set_key1(0);
    Keyboard.send_now();
    Keyboard.print(". ");
    Space = 0;
  }
} //    ------------------------------- This curly brace was missing
if(x > 774 & x < 855 & y < 289){
  Space = 0;
    Keyboard.print(",");
    delay(100);
}
if(x > 856 & x < 950 & y < 289){
  Space = 0;
    Num = Num + 1;
    delay(100);
    if(Num==3){
      Num=0;
  }
}
  delay(100);
}

I’m also sure that there are more optimised ways to write this code. The moment you see sections of code that looks the same, repeated, then you can be assured there is a better way of doing it… Write some functions, it will reduce your line count dramatically.

I also just noticed you are using the bitwise and operator, instead of the boolean && operators in all of your if statements, which will not give you the result you are looking for.

It needs to look more like:

  if ((x > 142) && (x < 202) && (y > 855) && (y < 892)) {

TRex:
I also just noticed you are using the bitwise and operator, instead of the boolean && operators in all of your if statements, which will not give you the result you are looking for.

It needs to look more like:

  if ((x > 142) && (x < 202) && (y > 855) && (y < 892)) {

Thank you so much!
Line 802 fixed it, thanks for taking your time to go through the code.
Using (x < 323) && (x > 937) seemed more accurate than &, so thanks, but is there anyway to do Find & Replace on this? Or not because of the different numbers within all of them.

Thanks anyway!