"expected '}' at end of input" on arduino code

37 Views Asked by At

I was writeing this simple arduino code and I got this error. I can clearly see that there are the appropriate brackets in place.

void setup() {
    // put your setup code here, to run once:
    pinMode(A7, OUTPUT);//sfx
    pinMode(A5, INPUT)pinMode(A6, OUTPUT);//flash
    ; //Button
}

void loop() {
    // put your main code here, to run repeatedly
    if (digitalRead(A5) == HIGH) {
        digitalWrite(A6 ,HIGH); //flash
        delay(250);
        digitalWrite(A6, LOW);
        delay(100);
        digitalWrite(A7, HIGH);
        delay(1000);
        digitalWrite(A7, LOW);
        delay(25000);
    } else if (digitalRead(A5) == LOW); 

    {                   
        digitalWrite(A6 ,HIGH); //flash
        delay(250);
        digitalWrite(A6, LOW);
        delay(100);
        digitalWrite(A7, HIGH);
        delay(1000);
        digitalWrite(A7, LOW);  
    }

I didn't know what to do to fi this issue.

1

There are 1 best solutions below

0
Chris On

Despite your assurance that you have the requisite brackets, you don't.

Your loop function needs a closing }.

Employing consistent indentation is not just about making code pretty. It makes it easier to understand and debug. Keep in mind also that it's always your fault.

As noted in comments, also beware the ; after else if (digitalRead(A5) == LOW). This won't cause a compiler error, but it radically changes the behavior of your code vs. what's intended.