Hello I am fairly new to using arduino, I have been using a arduino Uno for this project. The main goal is to have one light fade in and out while the other blinks rapidly, but I keep encountering the error "redefinition of 'void setup()'" This is my code so far.
int led2 = 4;
int led = 2;
int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
delay(30);
}
void setup() {
pinMode(led2, OUTPUT);
}
void loop() {
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
}