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:
}