im just starting to learn about arduino and im trying to make something with this code
int switchState = 0;
void setup() {
pinMode(1, INPUT);
pinMode(2, OUTPUT);
}
void loop() {
switchState = digitalRead(1);
//if the button is not pressed
if (switchState == LOW) [
digitalWrite(2, LOW);
]
//if the button is pressed
else {
digitalWrite(2, HIGH);
}
}
but it keeps giving me this message when i upload it
exit status 1
expected ',' before ';' token
and then it highlights digitalWrite(2, HIGH); in red
please help