Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ledAmarelo = 9;
- int ledAzul = 8;
- int leds[4] = {ledVermelho, ledVerde, ledAmarelo, ledAzul};
- int b1 = 3;
- int b2 = 4;
- int b3 = 5;
- int b4 = 6;
- int buzzer = 7;
- int estadoBotao1 = 0;
- int estadoBotao2 = 0;
- int estadoBotao3 = 0;
- int estadoBotao4 = 0;
- int botaoPressionado = 0;
- int sorteador(){
- return random(0,4);
- }
- void setup(){
- pinMode(ledVermelho, OUTPUT);
- pinMode(ledVerde, OUTPUT);
- pinMode(ledAmarelo, OUTPUT);
- pinMode(ledAzul, OUTPUT);
- pinMode(b1, INPUT);
- pinMode(b2, INPUT);
- pinMode(b3, INPUT);
- pinMode(b4, INPUT);
- pinMode(buzzer, OUTPUT);
- }
- void loop(){
- int numSorteado = sorteador();
- for(int i=0;i<1;i++){
- tone(buzzer,294);
- digitalWrite(leds[numSorteado],HIGH);
- delay(500);
- noTone(buzzer);
- digitalWrite(leds[numSorteado],LOW);
- delay(100);
- }
- }
- for(int i=0;i<1;i++){
- tone(buzzer,294);
- digitalWrite(leds[numSorteado],HIGH);
- delay(500);
- noTone(buzzer);
- digitalWrite(leds[numSorteado],LOW);
- delay(100); }
- for(int i=0;i<"Quantidade de leds iguais ou algo que vai definir a contagem";i++){
- tone(buzzer,294);
- digitalWrite(leds[numSorteado],HIGH);
- delay(500);
- noTone(buzzer);
- digitalWrite(leds[numSorteado],LOW);
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement