//3 btns
const int Rbtn = 2;
const int Bbtn = 3;
const int Gbtn = 4;
int btnDwn = 0; //buttonpress
int count = 10;
void setup() {
//3btns
pinMode(Rbtn, INPUT_PULLUP);
pinMode(Bbtn, INPUT_PULLUP);
pinMode(Gbtn, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
int rng = random(0, 4); //RNG 1-3
if(btnDwn == 0){ //if no buttons were pressed
if(digitalRead(Rbtn) == LOW || digitalRead(Bbtn) == LOW || digitalRead(Gbtn) == LOW ){
btnDwn = 1;
switch (rng){
case 1: //1. possibility
Serial.println("1st");
break;
case 2: //2. possibility
Serial.println("2nd");
break;
case 3: //3. possibility
Serial.println("3rd");
break;
}
}
//do coundown
if(count > 1){
count--;
Serial.println(count);
delay(1000);
}
}
}