'if/else' statement not being recognized in 1.6.12

Hello all,

i am very green to the arduino world. I am currently trying to incorporate inputs and outputs into my projects but when trying to insert the 'if/else statements it in not recognised.Arduino: 1.6.12 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Maxx\Documents\Arduino\button1\button1.ino: In function 'void loop()':

button1:15: error: 'else' without a previous 'if'

else

^

exit status 1
'else' without a previous 'if'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

(deleted)

Thank you for your swift reply :slight_smile:

int LEDblue=6;
int button=7;
int buttonstatus=0; //

void setup() {
pinMode(LEDblue, OUTPUT);
pinMode(button, INPUT);
}

void loop()

{

buttonstatus=digitalRead(button);

if (buttonstatus ==HIGH)

digitalWrite(LEDblue,HIGH);
delay(5000);
digitalWrite(LEDblue, LOW);
}

else

{

digitalWrite(LEDblue, LOW)

}

(deleted)

The opening curly bracket for the if statement is missing in your code.

Learn to match brackets somehow - its terribly useful!!

hey thanks for the help :smiley: ;D