Hi,
Im a beginner and just started learning how to use my Arduino UNO.
Here is my first code:
int switchState = 0;
void setup() {
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop() {
switchState = digitalRead(2)
// digitalRead checks for voltage
;if(switchState == LOW);
// two equal signs compare two things
digitalWrite(3, LOW); //green LED
digitalWrite(4, LOW); //red LED
digitalWrite(5, HIGH);// red LED
}
else {
digitalWrite(3,LOW);
digitalWrite(4,LOW) ;
digitalWrite(5,HIGH);
delay(250);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay(250);
}
Im not sure how to fix it. When I try to upload it to the UNO, it says this:
Error: Expected unqualified-id before 'else'
Can someone please help me?