#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <avr/pgmspace.h>
#include <string.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
#define BTN_START 8
#define BTN_MAS 9
#define BTN_MENOS 10
#define BTN_PASAR 7
#define BUZZER 6
int menu = 0;
bool enJuego = false;
// ── buffer temporal para leer strings de Flash ──
char buf[22];
// ================== QUIZ (strings en Flash) ==================
const char q0[] PROGMEM = "El sol es estrella?";
const char q1[] PROGMEM = "La tierra es plana?";
const char q2[] PROGMEM = "2+2 es igual a 4?";
const char q3[] PROGMEM = "Los peces viven agua?";
const char q4[] PROGMEM = "Los humanos vuelan?";
const char q5[] PROGMEM = "El hielo es frio?";
const char q6[] PROGMEM = "El fuego quema?";
const char q7[] PROGMEM = "Gatos maullan?";
const char q8[] PROGMEM = "Perros ladran?";
const char q9[] PROGMEM = "El agua moja?";
const char q10[] PROGMEM = "Luna es planeta?";
const char q11[] PROGMEM = "Ano tiene 12 meses?";
const char q12[] PROGMEM = "Aranas son insectos?";
const char q13[] PROGMEM = "Oro es metal?";
const char q14[] PROGMEM = "Pinguino vuela?";
const char q15[] PROGMEM = "Murcielago vuela?";
const char q16[] PROGMEM = "Delfin es pez?";
const char q17[] PROGMEM = "Electricidad mata?";
const char q18[] PROGMEM = "Minuto tiene 60seg?";
const char q19[] PROGMEM = "Triangulo 3 lados?";
const char q20[] PROGMEM = "Saturno tiene anillos?";
const char q21[] PROGMEM = "Luz viaja rapido?";
const char q22[] PROGMEM = "Ballena es mamifero?";
const char q23[] PROGMEM = "Diamante es duro?";
const char q24[] PROGMEM = "Luna tiene agua?";
const char q25[] PROGMEM = "Oxigeno es gas?";
const char q26[] PROGMEM = "Volcanes hay en mar?";
const char q27[] PROGMEM = "Humanos son mamiferos?";
const char q28[] PROGMEM = "Pluton es planeta?";
const char q29[] PROGMEM = "Mariposa es insecto?";
const char q30[] PROGMEM = "ADN esta en celulas?";
const char q31[] PROGMEM = "Arana tiene 8 patas?";
const char q32[] PROGMEM = "Hora tiene 60min?";
const char q33[] PROGMEM = "De noche hay sol?";
const char q34[] PROGMEM = "Pulpo tiene cerebro?";
const char q35[] PROGMEM = "Luz viaja en vacio?";
const char q36[] PROGMEM = "Avion vuela?";
const char q37[] PROGMEM = "En verano hace frio?";
const char q38[] PROGMEM = "Abeja hace miel?";
const char q39[] PROGMEM = "Tierra orbita al sol?";
const char q40[] PROGMEM = "Corazon bombea sangre?";
const char q41[] PROGMEM = "Plantas producen O2?";
const char q42[] PROGMEM = "3x3 es igual a 9?";
const char q43[] PROGMEM = "Nubes son de agua?";
const char q44[] PROGMEM = "Cactus vive desierto?";
const char q45[] PROGMEM = "Tiburon es mamifero?";
const char q46[] PROGMEM = "Hierro es metal?";
const char q47[] PROGMEM = "La nieve es caliente?";
const char q48[] PROGMEM = "Caracol tiene concha?";
const char q49[] PROGMEM = "Mosca tiene alas?";
const char q50[] PROGMEM = "Tierra tiene 1 luna?";
const char q51[] PROGMEM = "Marte es de color rojo?";
const char q52[] PROGMEM = "Camello vive desierto?";
const char q53[] PROGMEM = "Oceano es agua dulce?";
const char q54[] PROGMEM = "Cocodrilo es reptil?";
const char q55[] PROGMEM = "Dormir es necesario?";
const char q56[] PROGMEM = "Piano hace sonido?";
const char q57[] PROGMEM = "Zorro es carnivoro?";
const char q58[] PROGMEM = "Semana tiene 7 dias?";
const char q59[] PROGMEM = "Plantas necesitan luz?";
const char q60[] PROGMEM = "Arcoiris tiene colores?";
const char q61[] PROGMEM = "Virus son seres vivos?";
const char q62[] PROGMEM = "Cuadrado 4 lados?";
const char q63[] PROGMEM = "Gato tiene 6 patas?";
const char q64[] PROGMEM = "Cebra tiene rayas?";
const char q65[] PROGMEM = "Tortugas son lentas?";
const char q66[] PROGMEM = "Cerebro esta en pie?";
const char q67[] PROGMEM = "El helado es caliente?";
const char q68[] PROGMEM = "Oso hiberna invierno?";
const char q69[] PROGMEM = "Pez nada en agua?";
const char q70[] PROGMEM = "El sol es un planeta?";
const char q71[] PROGMEM = "Teclado es hardware?";
const char q72[] PROGMEM = "Queso viene de leche?";
const char q73[] PROGMEM = "Elefante es pequeno?";
const char q74[] PROGMEM = "Anno tiene 365 dias?";
const char q75[] PROGMEM = "Las nubes pesan algo?";
const char q76[] PROGMEM = "Jirafa cuello largo?";
const char q77[] PROGMEM = "Hielo flota en agua?";
const char q78[] PROGMEM = "Bacteria es visible?";
const char q79[] PROGMEM = "Lluvia viene de nubes?";
const char q80[] PROGMEM = "El loro puede hablar?";
const char q81[] PROGMEM = "Dinosaurios viven hoy?";
const char q82[] PROGMEM = "Pulmones son respirar?";
const char q83[] PROGMEM = "Foca vive en el calor?";
const char q84[] PROGMEM = "Salmon es un pez?";
const char q85[] PROGMEM = "Cubo tiene 6 caras?";
const char q86[] PROGMEM = "Mercurio orbita el sol?";
const char q87[] PROGMEM = "Cangrejo 10 patas?";
const char q88[] PROGMEM = "El viento se puede ver?";
const char q89[] PROGMEM = "Hormiga levanta mucho?";
const char q90[] PROGMEM = "Internet existe hoy?";
const char q91[] PROGMEM = "Medusa tiene huesos?";
const char q92[] PROGMEM = "Humano tiene 2 ojos?";
const char q93[] PROGMEM = "Volcan expulsa lava?";
const char q94[] PROGMEM = "Serpiente tiene patas?";
const char q95[] PROGMEM = "Dia tiene 24 horas?";
const char q96[] PROGMEM = "Pinguino vive en polo?";
const char q97[] PROGMEM = "Fuego necesita O2?";
const char q98[] PROGMEM = "Robot tiene emociones?";
const char q99[] PROGMEM = "El cielo es azul?";
const char* const preguntas[] PROGMEM = {
q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,
q10,q11,q12,q13,q14,q15,q16,q17,q18,q19,
q20,q21,q22,q23,q24,q25,q26,q27,q28,q29,
q30,q31,q32,q33,q34,q35,q36,q37,q38,q39,
q40,q41,q42,q43,q44,q45,q46,q47,q48,q49,
q50,q51,q52,q53,q54,q55,q56,q57,q58,q59,
q60,q61,q62,q63,q64,q65,q66,q67,q68,q69,
q70,q71,q72,q73,q74,q75,q76,q77,q78,q79,
q80,q81,q82,q83,q84,q85,q86,q87,q88,q89,
q90,q91,q92,q93,q94,q95,q96,q97,q98,q99
};
const bool respuestas[] PROGMEM = {
// 0-9
true,false,true,true,false,true,true,true,true,true,
// 10-19
false,true,false,true,false,true,false,true,true,true,
// 20-29
true,true,true,true,true,true,true,true,false,true,
// 30-39
true,true,true,false,true,true,true,false,true,true,
// 40-49
true,true,true,true,true,false,true,false,true,true,
// 50-59
true,true,true,false,true,true,true,true,true,true,
// 60-69
true,true,true,false,true,true,false,false,true,true,
// 70-79
false,true,true,false,true,true,true,true,false,true,
// 80-89
true,false,true,false,true,true,true,true,false,true,
// 90-99
true,false,true,true,false,true,true,true,false,true
};
int totalPreguntas = 100;
// helper: lee pregunta de Flash al buffer
void leerPregunta(int idx) {
strcpy_P(buf, (char*)pgm_read_word(&preguntas[idx]));
}
// helper: lee respuesta de Flash
bool leerRespuesta(int idx) {
return pgm_read_byte(&respuestas[idx]);
}
// ================= IMPOSTOR (strings en Flash) =================
int jugadores;
int jugadorActual;
int impostor;
char palabra[14];
const char p0[] PROGMEM = "PERRO";
const char p1[] PROGMEM = "GATO";
const char p2[] PROGMEM = "ELEFANTE";
const char p3[] PROGMEM = "TIBURON";
const char p4[] PROGMEM = "DELFIN";
const char p5[] PROGMEM = "COCINA";
const char p6[] PROGMEM = "SARTEN";
const char p7[] PROGMEM = "CUCHILLO";
const char p8[] PROGMEM = "TENEDOR";
const char p9[] PROGMEM = "CUCHARA";
const char p10[] PROGMEM = "PLAYA";
const char p11[] PROGMEM = "MONTANA";
const char p12[] PROGMEM = "DESIERTO";
const char p13[] PROGMEM = "SELVA";
const char p14[] PROGMEM = "RIO";
const char p15[] PROGMEM = "COLEGIO";
const char p16[] PROGMEM = "UNIVERSIDAD";
const char p17[] PROGMEM = "PROFESOR";
const char p18[] PROGMEM = "EXAMEN";
const char p19[] PROGMEM = "TAREA";
const char p20[] PROGMEM = "HELADO";
const char p21[] PROGMEM = "PIZZA";
const char p22[] PROGMEM = "HAMBURGUESA";
const char p23[] PROGMEM = "SUSHI";
const char p24[] PROGMEM = "PASTA";
const char p25[] PROGMEM = "FUTBOL";
const char p26[] PROGMEM = "BASQUET";
const char p27[] PROGMEM = "TENIS";
const char p28[] PROGMEM = "NATACION";
const char p29[] PROGMEM = "CICLISMO";
const char p30[] PROGMEM = "CELULAR";
const char p31[] PROGMEM = "COMPUTADORA";
const char p32[] PROGMEM = "TABLET";
const char p33[] PROGMEM = "TECLADO";
const char p34[] PROGMEM = "MOUSE";
const char p35[] PROGMEM = "AVION";
const char p36[] PROGMEM = "BARCO";
const char p37[] PROGMEM = "CARRO";
const char p38[] PROGMEM = "BICICLETA";
const char p39[] PROGMEM = "TREN";
const char p40[] PROGMEM = "MUSICA";
const char p41[] PROGMEM = "GUITARRA";
const char p42[] PROGMEM = "PIANO";
const char p43[] PROGMEM = "BATERIA";
const char p44[] PROGMEM = "CANCION";
const char p45[] PROGMEM = "PELICULA";
const char p46[] PROGMEM = "SERIE";
const char p47[] PROGMEM = "NETFLIX";
const char p48[] PROGMEM = "CINE";
const char p49[] PROGMEM = "TEATRO";
const char p50[] PROGMEM = "DOCTOR";
const char p51[] PROGMEM = "ENFERMERA";
const char p52[] PROGMEM = "POLICIA";
const char p53[] PROGMEM = "BOMBERO";
const char p54[] PROGMEM = "CHEF";
const char p55[] PROGMEM = "ROBOT";
const char p56[] PROGMEM = "VIDEOJUEGO";
const char p57[] PROGMEM = "MINECRAFT";
const char p58[] PROGMEM = "ROBLOX";
const char p59[] PROGMEM = "PLANETA";
const char p60[] PROGMEM = "MARTE";
const char p61[] PROGMEM = "JUPITER";
const char p62[] PROGMEM = "SATURNO";
const char p63[] PROGMEM = "LUNA";
const char p64[] PROGMEM = "DRAGON";
const char p65[] PROGMEM = "UNICORNIO";
const char p66[] PROGMEM = "MAGIA";
const char p67[] PROGMEM = "CASTILLO";
const char p68[] PROGMEM = "ZAPATO";
const char p69[] PROGMEM = "CAMISA";
const char p70[] PROGMEM = "PANTALON";
const char p71[] PROGMEM = "SOMBRERO";
const char p72[] PROGMEM = "CHAQUETA";
const char p73[] PROGMEM = "CHOCOLATE";
const char p74[] PROGMEM = "CARAMELO";
const char p75[] PROGMEM = "PASTEL";
const char p76[] PROGMEM = "GALLETAS";
const char p77[] PROGMEM = "DULCE";
const char p78[] PROGMEM = "AMIGO";
const char p79[] PROGMEM = "FAMILIA";
const char p80[] PROGMEM = "VECINO";
const char p81[] PROGMEM = "COMPANERO";
const char p82[] PROGMEM = "RELOJ";
const char p83[] PROGMEM = "ESPEJO";
const char p84[] PROGMEM = "PUERTA";
const char p85[] PROGMEM = "VENTANA";
const char p86[] PROGMEM = "SILLA";
const char p87[] PROGMEM = "FANTASMA";
const char p88[] PROGMEM = "MONSTRUO";
const char p89[] PROGMEM = "VAMPIRO";
const char p90[] PROGMEM = "ZOMBIE";
const char p91[] PROGMEM = "BRUJA";
const char* const palabras[] PROGMEM = {
p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,
p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,
p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,
p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,
p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,
p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,
p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,
p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,
p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,
p90,p91
};
int totalPalabras = 92;
void leerPalabra(int idx) {
strcpy_P(palabra, (char*)pgm_read_word(&palabras[idx]));
}
// ================= LOGO =================
void logoNebula() {
lcd.clear();
for (int i = 0; i < 2; i++) {
lcd.clear();
lcd.setCursor(7, i);
lcd.print("NEBULA");
delay(250);
}
lcd.setCursor(5, 3);
lcd.print("loading...");
for (int i = 0; i < 2; i++) {
tone(BUZZER, 523, 120); delay(160);
tone(BUZZER, 659, 120); delay(160);
tone(BUZZER, 698, 120); delay(160);
tone(BUZZER, 784, 250); delay(300);
}
delay(800);
}
// ================= SETUP =================
void setup() {
lcd.init();
lcd.backlight();
pinMode(BTN_START, INPUT_PULLUP);
pinMode(BTN_MAS, INPUT_PULLUP);
pinMode(BTN_MENOS, INPUT_PULLUP);
pinMode(BTN_PASAR, INPUT_PULLUP);
pinMode(BUZZER, OUTPUT);
randomSeed(analogRead(A0));
logoNebula();
mostrarMenu();
}
// ================= LOOP =================
void loop() {
if (!enJuego) {
if (!digitalRead(BTN_MENOS)) { menu--; if (menu < 0) menu = 3; mostrarMenu(); delay(200); }
if (!digitalRead(BTN_MAS)) { menu++; if (menu > 3) menu = 0; mostrarMenu(); delay(200); }
if (!digitalRead(BTN_START)) {
delay(200);
enJuego = true;
if (menu == 0) quiz();
if (menu == 1) reflejo();
if (menu == 2) impostorGame();
if (menu == 3) ppt();
enJuego = false;
mostrarMenu();
}
}
}
// ================= MENU =================
void mostrarMenu() {
lcd.clear();
lcd.setCursor(0, 0); lcd.print(menu == 0 ? ">Quiz" : " Quiz");
lcd.setCursor(0, 1); lcd.print(menu == 1 ? ">Reflejo" : " Reflejo");
lcd.setCursor(0, 2); lcd.print(menu == 2 ? ">Impostor" : " Impostor");
lcd.setCursor(0, 3); lcd.print(menu == 3 ? ">PPT" : " PPT");
}
// ================= QUIZ =================
void quiz() {
int aciertos = 0;
int seleccion[10];
bool usado[100];
for (int i = 0; i < totalPreguntas; i++) usado[i] = false;
for (int i = 0; i < 10; i++) {
int r;
do { r = random(0, totalPreguntas); } while (usado[r]);
usado[r] = true;
seleccion[i] = r;
}
for (int i = 0; i < 10; i++) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Pregunta ");
lcd.print(i + 1);
lcd.print("/10");
leerPregunta(seleccion[i]);
lcd.setCursor(0, 2);
lcd.print(buf);
lcd.setCursor(0, 3);
lcd.print("+Si -No");
bool respondido = false;
bool respuesta = false;
while (!respondido) {
if (!digitalRead(BTN_MAS)) { respuesta = true; respondido = true; tone(BUZZER, 900, 80); }
if (!digitalRead(BTN_MENOS)) { respuesta = false; respondido = true; tone(BUZZER, 700, 80); }
if (!digitalRead(BTN_PASAR)) return;
}
delay(200);
if (respuesta == leerRespuesta(seleccion[i])) {
aciertos++;
tone(BUZZER, 1200, 150);
} else {
tone(BUZZER, 200, 200);
}
delay(600);
}
lcd.clear();
lcd.setCursor(5, 1); lcd.print("Puntaje");
lcd.setCursor(7, 2); lcd.print(aciertos); lcd.print("/10");
tone(BUZZER, 1000, 200);
delay(2500);
}
// ================= REFLEJO =================
void reflejo() {
unsigned long tiempos[3];
int rondas = 3;
lcd.clear();
lcd.setCursor(4, 1); lcd.print("REFLEJO x3");
lcd.setCursor(3, 3); lcd.print("Btn START");
while (digitalRead(BTN_START));
delay(400);
for (int r = 0; r < rondas; r++) {
lcd.clear();
lcd.setCursor(3, 0); lcd.print("Ronda "); lcd.print(r+1); lcd.print("/3");
lcd.setCursor(5, 2); lcd.print("Espera...");
unsigned long espera = random(1500, 4000);
unsigned long inicio = millis();
bool trampa = false;
while (millis() - inicio < espera) {
if (!digitalRead(BTN_START)) { trampa = true; break; }
}
if (trampa) {
lcd.clear();
lcd.setCursor(4, 1); lcd.print("TRAMPA!");
lcd.setCursor(2, 2); lcd.print("Ronda anulada");
tone(BUZZER, 200, 500);
delay(1500); r--; delay(500);
continue;
}
lcd.clear();
lcd.setCursor(8, 1); lcd.print("YA!");
tone(BUZZER, 1400, 60);
unsigned long t = millis();
bool presionado = false;
while (millis() - t < 3000) {
if (!digitalRead(BTN_START)) { tiempos[r] = millis() - t; presionado = true; break; }
}
if (!presionado) tiempos[r] = 3000;
lcd.clear();
lcd.setCursor(4, 1); lcd.print(tiempos[r]); lcd.print(" ms");
if (tiempos[r] < 200) { lcd.setCursor(5,2); lcd.print("Pro!"); tone(BUZZER,1600,100); }
else if (tiempos[r] < 400) { lcd.setCursor(4,2); lcd.print("Bien!"); tone(BUZZER,1200,100); }
else if (tiempos[r] < 3000) { lcd.setCursor(3,2); lcd.print("Lento :("); tone(BUZZER, 600,200); }
else { lcd.setCursor(3,2); lcd.print("Timeout!"); tone(BUZZER, 300,300); }
delay(1800);
}
unsigned long suma = 0;
for (int i = 0; i < rondas; i++) suma += tiempos[i];
unsigned long promedio = suma / rondas;
lcd.clear();
lcd.setCursor(3, 0); lcd.print("Promedio:");
lcd.setCursor(6, 1); lcd.print(promedio); lcd.print(" ms");
lcd.setCursor(2, 3);
if (promedio < 200) lcd.print("Eres una bala!");
else if (promedio < 350) lcd.print("Muy buen refle!");
else if (promedio < 500) lcd.print("Puedes mejorar");
else lcd.print("Sigue practica");
tone(BUZZER,1000,150); delay(200);
tone(BUZZER,1200,150); delay(200);
tone(BUZZER,1400,250);
delay(3000);
}
// ================= IMPOSTOR =================
void impostorGame() {
jugadores = 3;
lcd.clear();
lcd.setCursor(4, 1); lcd.print("IMPOSTOR");
lcd.setCursor(0, 3); lcd.print("Start");
while (digitalRead(BTN_START));
tone(BUZZER, 800, 200);
delay(400);
while (true) {
lcd.clear();
lcd.setCursor(0, 1); lcd.print("Jugadores:");
lcd.setCursor(11,1); lcd.print(jugadores);
lcd.setCursor(0, 3); lcd.print("+ - Start");
if (!digitalRead(BTN_MAS)) { jugadores++; if (jugadores>15) jugadores=15; tone(BUZZER,1000,80); delay(200); }
if (!digitalRead(BTN_MENOS)) { jugadores--; if (jugadores< 3) jugadores= 3; tone(BUZZER, 800,80); delay(200); }
if (!digitalRead(BTN_START)) break;
}
jugadorActual = 1;
impostor = random(1, jugadores + 1);
leerPalabra(random(0, totalPalabras));
while (jugadorActual <= jugadores) {
lcd.clear();
lcd.setCursor(0, 0); lcd.print("Jugador "); lcd.print(jugadorActual);
lcd.setCursor(0, 3); lcd.print("PASAR");
while (digitalRead(BTN_PASAR));
delay(300);
lcd.clear();
if (jugadorActual == impostor) {
lcd.setCursor(4, 1); lcd.print("IMPOSTOR");
tone(BUZZER, 200, 400);
} else {
lcd.setCursor(6, 0); lcd.print("CIVIL");
lcd.setCursor(2, 1); lcd.print("PALABRA");
lcd.setCursor(3, 3); lcd.print(palabra);
tone(BUZZER, 1000, 150);
}
while (digitalRead(BTN_PASAR));
jugadorActual++;
delay(300);
}
lcd.clear();
lcd.setCursor(4, 1); lcd.print("FIN JUEGO");
tone(BUZZER, 523, 150); delay(200);
tone(BUZZER, 784, 200);
delay(2000);
}
// ================= PIEDRA PAPEL TIJERA =================
void ppt() {
int winsJugador = 0, winsMaquina = 0, empates = 0, ronda = 1;
const int RONDAS = 5;
const char* nombres[] = {"Piedra","Papel ","Tijera"};
const int resultado[3][3] = {{0,2,1},{1,0,2},{2,1,0}};
lcd.clear();
lcd.setCursor(3, 0); lcd.print("PIEDRA PAPEL");
lcd.setCursor(5, 1); lcd.print("TIJERA");
lcd.setCursor(0, 3); lcd.print("+Pie -Pap PAS=Tij");
delay(2000);
while (ronda <= RONDAS) {
lcd.clear();
lcd.setCursor(0, 0); lcd.print("Ronda "); lcd.print(ronda); lcd.print("/"); lcd.print(RONDAS);
lcd.setCursor(0, 1); lcd.print("Tu: ");
lcd.setCursor(11,1); lcd.print("M:"); lcd.setCursor(13,1); lcd.print(winsJugador); lcd.print("-"); lcd.print(winsMaquina);
lcd.setCursor(0, 3); lcd.print("+Pie -Pap PAS=Tij");
int elJ = -1;
while (elJ == -1) {
if (!digitalRead(BTN_MAS)) elJ = 0;
if (!digitalRead(BTN_MENOS)) elJ = 1;
if (!digitalRead(BTN_PASAR)) elJ = 2;
if (!digitalRead(BTN_START)) return;
}
tone(BUZZER, 800, 60); delay(150);
lcd.setCursor(4,1); lcd.print("..."); delay(300);
lcd.setCursor(4,1); lcd.print(" "); delay(200);
lcd.setCursor(4,1); lcd.print("..."); delay(300);
int elM = random(0, 3);
lcd.clear();
lcd.setCursor(0,0); lcd.print("Tu: "); lcd.print(nombres[elJ]);
lcd.setCursor(0,1); lcd.print("PC: "); lcd.print(nombres[elM]);
int res = resultado[elJ][elM];
lcd.setCursor(0, 3);
if (res == 0) {
lcd.print(" -- EMPATE -- "); empates++;
tone(BUZZER,700,100); delay(150); tone(BUZZER,700,100);
} else if (res == 1) {
lcd.print(" *** GANASTE ***"); winsJugador++;
tone(BUZZER,1000,80); delay(100); tone(BUZZER,1200,80); delay(100); tone(BUZZER,1500,150);
} else {
lcd.print(" -- PERDISTE --"); winsMaquina++;
tone(BUZZER,400,200); delay(250); tone(BUZZER,250,300);
}
delay(2000);
ronda++;
}
lcd.clear();
lcd.setCursor(4, 0); lcd.print("RESULTADO");
lcd.setCursor(0, 1); lcd.print("Tu: "); lcd.print(winsJugador); lcd.print(" PC: "); lcd.print(winsMaquina);
lcd.setCursor(0, 2); lcd.print("Empates: "); lcd.print(empates);
lcd.setCursor(1, 3);
if (winsJugador > winsMaquina) {
lcd.print("GANASTE LA SERIE");
tone(BUZZER,523,100); delay(130); tone(BUZZER,659,100); delay(130);
tone(BUZZER,784,100); delay(130); tone(BUZZER,1047,300);
} else if (winsMaquina > winsJugador) {
lcd.print("PERDISTE LA SERI");
tone(BUZZER,300,200); delay(250); tone(BUZZER,200,400);
} else {
lcd.print(" SERIE EMPATADA");
tone(BUZZER,700,150); delay(200); tone(BUZZER,700,150);
}
delay(3500);
}