This is kind of driving me nuts. Thanks in advance for any help you may give.
I'm not a total noob but still a beginner. I keep getting the error "expected '}' before 'else'" but when I look at the code, the } is right there in plain sight. Here's the full verbose error message (with the file name and location removed because it contains personal information):
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"
In function 'void motor_control()':
Sensor___Motor_Trial:185:7: error: expected '}' before 'else'
} else if (abs(Azidif) <= ThrOFF); {
^
At global scope:
Sensor___Motor_Trial:190:1: error: expected declaration before '}' token
}
^
exit status 1
expected '}' before 'else'
Now, here's the code snippit (odd, the numbers didn't come too)
void motor_control(void) {
if (abs(Azidif) > ThrON) {
if ( (avl > avr) && (digitalRead(LimitPinW) == HIGH)) //may need to add a threshold here too
{ //turn azimuth motor to the west
digitalWrite(MDAziPinA, HIGH);
digitalWrite(MDAziPinB, LOW);
delay(500); //run for ½ second
void motor_stop();
} else if ((avr < avl) && digitalRead(LimitPinE) == HIGH); {
//turn azimuth motor to the east – used to restart in AM)
digitalWrite(MDAziPinA, LOW);
digitalWrite(MDAziPinB, HIGH);
//no delay,keep going until condition drops out)
//void motor_stop(void);
} else if (abs(Azidif) <= ThrOFF); {
void motor_stop();
delay(500);
}
}
}
This is draft code for a two-axis solar tracker. I've checked that all the { and } match. This was typed in, not copied and pasted from elsewhere. I have searched the forum, read a wide variety Arduino reference pages, and done a google search of the error. Learned lots of stuff, but didn't find the source of the error.
There's a screen shot too, though I can't see it in the preview. I'll attach the full code if necessary, perhaps the error source is elsewhere (but the compiler shows it on the highlighted line).
