Error
Archiviert 3 years ago
E
nia
this is my code
int red = 10;
int yellow = 9;
int green = 8;
void setup(){
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
}
void loop(){
int changeLights();{
delay(15000);
}
{void changeLights()
// green off, yellow on for 3 seconds
;digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(3000);
//turn off yellow, then turn red on for 5 seconds
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
delay(5000);
//red and yellow on for 2 seconds (red is already on though)
digitalWrite(yellow, HIGH);
delay(2000);
//turn off red and yellow, then turn on green
digitalWrite(yellow, LOW);
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
delay(3000);
}
}
int button = 12; // switch is on pin 12
pinMode(button, INPUT);
digitalWrite(green, HIGH);
if (digitalRead(button) == HIGH){
delay(15); // software debounce
if (digitalRead(button) == HIGH){
// if the switch is HIGH, ie. pushed down - change the lights!
int changeLights();
delay(15000)
}
}
The error says
expected constructor, destructor, or type conversion before '(' token
^ 3 times
it also says
expected declaration before '}' token
I don't know how to fix this <:blue_sob:981939474806239302>
