const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int greenLedPin = 7;
const int redLedPin = 8;
int number;
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(greenLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
randomSeed(analogRead(0));
number = random(1, 4);
}
void loop() {
if (digitalRead(buttonPin1) && number == 1) {
digitalWrite(greenLedPin, HIGH);
} else if (digitalRead(buttonPin2) && number == 2) {
digitalWrite(greenLedPin, HIGH);
} else if (digitalRead(buttonPin3) && number == 3) {
digitalWrite(greenLedPin, HIGH);
} else {
digitalWrite(redLedPin, HIGH);
}
}