Hey, I'm new to Arduino and am just learning the basics. That being said, here's my problem:
Error:
redefinition of 'void setup ()'
My code:
void setup() {
}
void loop() {
}
int switchState = 0;
void setup () {
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (2, INPUT);
}
void loop() {
switchState = digitalWrite(2);
if (switchState == LOW) {
//The button is pushed
digitalWrite (3, LOW);
digitalWrite (4, LOW);
digitalWrite (5, HIGH);
delay(250); //Wait a quarter of a second
digitalWrite (4, HIGH);
digitalWrite (5, LOW);
delay(250);
}
}
Any help is appreciated, thanks!
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.