Need help fixing: error: expected primary-expression before '}' token

Please note, this is my third original project with Arduino and C++ so I am aware my code is not too clean or well made for that matter.

My question is, as said in the subject, when I try to compile, I get the error In function 'void loop()':
Follow_test:77: error: expected primary-expression before '}' token. Could somebody please help me sort this out. This program is supposed to be a base which I can expand upon to get my IR sensor to track moving objects. Full error is:

Follow_test:77: error: expected primary-expression before '}' token
}
^
Follow_test:77: error: expected ';' before '}' token
exit status 1
expected primary-expression before '}' token

Thanks in advance!

/* Track
 *  by R Johnson 1-27-16
 */

 #include <Servo.h>

 Servo pan;
 Servo tilt;
 int IR=1;
 int val;
 int mm;
 int in;
 int i;
 int p = 90;
 int t = 15;
 int pm = 90;
 int tm= 45;
 
void setup() {
  pan.attach(50);
  tilt.attach(52);
  Serial.begin(9600);
  pinMode(IR,OUTPUT);
}

void loop() { //this code is designed to follow my hand as i move it
  pan.write(pm);
  tilt.write(tm);
  i=analogRead(IR);
  val=(6762/(i-9))-4;
  mm=(val*10);
  in=(mm*.03937);
  while(in < 5.5){
    Serial.println("Still within appropriate range");
    Serial.println(in);
    i=analogRead(IR);
    val=(6762/(i-9))-4;
    mm=(val*10);
    in=(mm*.03937);
    delay(500);
    continue;
  }
  start:
  pan.write(pm);
  Serial.println("back to start");
  i=analogRead(IR);
  val=(6762/(i-9))-4;
  mm=(val*10);
  in=(mm*.03937);
  if(in > 5){//checks if IR sensor thinks object is greater than 5 inches away
    if(90 <= pm <= 180){
      goto start1;
    }
    else
    {
      if(0 <= pm <= 90){
        pm = pm - 1;
        goto start2;
      }
    }
  }
  else
  {
    goto start;
  }
  goto end1;
  Serial.println("Can I even trigger this?");
  start1:
  for(pm = 90; pm = 180; pm++);
  Serial.println("moving up to 180");
  pan.write(pm);
  goto start;
  start2:
  for(pm = 90; pm = 0; pm--);
  Serial.println("moving down to 0");
  end1:
}

Apart from definitely not using goto, what is this doing?

  for(pm = 90; pm = 180; pm++);

Now that I look back on the code I realize how terribly sloppy it is. I will remove all the gotos and attempt to clean it up. As for the part you are asking about, that was supposed to move the servo to position 180. Thanks for the quick responses.

    if(90 <= pm <= 180){

That will not do what you expect. I suggest a basic course in C programming. And lose all the gotos.

ravi60:
As for the part you are asking about, that was supposed to move the servo to position 180.

All that does is:

  • Assign 90 to "pm"
  • Assign 180 to "pm"
  • Check if "pm" is non-zero (which it is, being 180)
  • If "pm" is non-zero, repeat the body of the loop, which itself does nothing because of the semicolon.

Similar problem here:

  for(pm = 90; pm = 0; pm--);

Thank you guys very much, sorry if this was a waste of time.