Hello, good day.
I am working on this project and I get this error at compilation.
The error message says "a function definition not allowed here before '{' token".
After reading through similar issues on the forum, it seemed to come from opening and closing braces not being used correctly and there were suggestions to use the Auto-format feature.
I have gone through my code severally ad I can't seem to find any opening brace that is not closed properly. I have also used the auto-format feature and it doesn't have problems with the code but I keep getting the error.
I have cut out the part of the code giving me the problem and pasted it.
I have attached the full code also.
void loop()
{
//Error is on the line above this
keypressed = myKeypad.getKey();
if (keypressed == 'E') { // E to open the lock
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter code"); //Message to show
GetCode(); //Getting code function
if (a == sizeof(code)) { //The GetCode function assign a value to a (it's correct when it has the size of the code array)
OpenDoor(); //Open lock function if code is correct
}
else {
lcd.clear();
lcd.print("Wrong"); //Message to print when the code is wrong
delay(2000);
lcd.clear();
lcd.print("System off!");
}
delay(2000);
//lcd.clear();
//lcd.print("Standby"); //Return to standby mode it's the message do display when waiting
}
if (keypressed == 'C') { //To change the code it calls the changecode function
ChangeCode();
lcd.clear();
lcd.print("System off!"); //When done, it returns to standby mode
}
if (keypressed == 'F') {
masteropen();
lcd.clear();
lcd.print("System bypassed");
delay(1500);
lcd.clear();
lcd.print("System on");
}
}
Display_mine.ino (9.48 KB)