{"id":27624289,"url":"https://github.com/arthurtaveira/arduinoproject-geniusgame","last_synced_at":"2026-04-29T08:32:12.758Z","repository":{"id":288779811,"uuid":"969159335","full_name":"ArthurTaveira/ArduinoProject-GeniusGame","owner":"ArthurTaveira","description":"Esse é o jogo Genius (Simon) feito em C++ para Arduino. O objetivo é simples: siga as sequências de luzes e sons e tente lembrar a ordem. Conforme o jogo avança, as sequências ficam mais longas e o desafio aumenta.","archived":false,"fork":false,"pushed_at":"2025-04-19T15:00:04.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T18:29:58.706Z","etag":null,"topics":["arduino","cpp","eletronic","ino"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArthurTaveira.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-19T14:21:07.000Z","updated_at":"2025-04-19T15:00:07.000Z","dependencies_parsed_at":"2025-04-19T18:40:32.923Z","dependency_job_id":null,"html_url":"https://github.com/ArthurTaveira/ArduinoProject-GeniusGame","commit_stats":null,"previous_names":["arthurtaveira/arduinoproject-geniusgame"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurTaveira%2FArduinoProject-GeniusGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurTaveira%2FArduinoProject-GeniusGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurTaveira%2FArduinoProject-GeniusGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurTaveira%2FArduinoProject-GeniusGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArthurTaveira","download_url":"https://codeload.github.com/ArthurTaveira/ArduinoProject-GeniusGame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250424174,"owners_count":21428315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","cpp","eletronic","ino"],"created_at":"2025-04-23T11:27:57.147Z","updated_at":"2026-04-29T08:32:12.752Z","avatar_url":"https://github.com/ArthurTaveira.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 Projeto Genius (Simon Game) com Arduino\n\nEste é um jogo **Genius (Simon)** feito com **Arduino**, que desafia sua memória com sequências de luzes e sons. \n\n![Foto do projeto](GeniusGame.jpeg)\n\n## 📦 Componentes necessários\n\n- 4 Botões (cores: verde, vermelho, amarelo e azul)\n- 4 LEDs (mesmas cores dos botões)\n- 1 Buzzer\n- 1 Arduino UNO (ou compatível)\n- Jumpers\n- Protoboard\n\n## ⚙️ Conexões dos componentes\n\n| Componente  | Pino Arduino |\n|-------------|--------------|\n| LED Verde   | 2            |\n| LED Vermelho| 3            |\n| LED Amarelo | 4            |\n| LED Azul    | 5            |\n| Botão Verde | 6            |\n| Botão Vermelho | 7         |\n| Botão Amarelo | 8          |\n| Botão Azul  | 9            |\n| Buzzer      | 10           |\n\n\u003e Obs: Os botões devem ser conectados com **pull-down resistors** ou configurados via `INPUT_PULLUP` com lógica invertida, caso preferir.\n## ⚙️ Código do Projeto\n\n```cpp\n// Definindo os pinos dos LEDs e botões\nconst int ledVerde = 2;\nconst int ledVermelho = 3;\nconst int ledAmarelo = 4;\nconst int ledAzul = 5;\n\nconst int botaoVerde = 6;\nconst int botaoVermelho = 7;\nconst int botaoAmarelo = 8;\nconst int botaoAzul = 9;\n\nconst int buzzer = 10;\n\nint sequencia[100];  // Sequência gerada pelo jogo\nint tamanhoSequencia = 0; // Tamanho da sequência atual\nint jogador = 1;  // Controle para o modo 2 jogadores\n\nvoid setup() {\n  // Configurando os pinos dos LEDs e botões\n  pinMode(ledVerde, OUTPUT);\n  pinMode(ledVermelho, OUTPUT);\n  pinMode(ledAmarelo, OUTPUT);\n  pinMode(ledAzul, OUTPUT);\n\n  pinMode(botaoVerde, INPUT_PULLUP);\n  pinMode(botaoVermelho, INPUT_PULLUP);\n  pinMode(botaoAmarelo, INPUT_PULLUP);\n  pinMode(botaoAzul, INPUT_PULLUP);\n  pinMode(buzzer, OUTPUT);\n\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  if (jogador == 1) {\n    modoMemoria();\n  } else {\n    modo2Jogadores();\n  }\n}\n\nvoid modoMemoria() {\n  gerarSequencia();\n  mostrarSequencia();\n  if (verificarSequencia()) {\n    tamanhoSequencia++;\n    delay(500);\n  } else {\n    jogoPerdido();\n  }\n}\n\nvoid gerarSequencia() {\n  sequencia[tamanhoSequencia] = random(4);  // Escolhe um número aleatório entre 0 e 3\n}\n\nvoid mostrarSequencia() {\n  for (int i = 0; i \u003c= tamanhoSequencia; i++) {\n    acionarLed(sequencia[i]);\n    delay(1000);\n    desligarLeds();\n    delay(500);\n  }\n}\n\nvoid acionarLed(int cor) {\n  switch (cor) {\n    case 0:\n      digitalWrite(ledVerde, HIGH);\n      tone(buzzer, 1000);  // Som associado ao verde\n      break;\n    case 1:\n      digitalWrite(ledVermelho, HIGH);\n      tone(buzzer, 1500);  // Som associado ao vermelho\n      break;\n    case 2:\n      digitalWrite(ledAmarelo, HIGH);\n      tone(buzzer, 2000);  // Som associado ao amarelo\n      break;\n    case 3:\n      digitalWrite(ledAzul, HIGH);\n      tone(buzzer, 2500);  // Som associado ao azul\n      break;\n  }\n}\n\nvoid desligarLeds() {\n  digitalWrite(ledVerde, LOW);\n  digitalWrite(ledVermelho, LOW);\n  digitalWrite(ledAmarelo, LOW);\n  digitalWrite(ledAzul, LOW);\n  noTone(buzzer);\n}\n\nbool verificarSequencia() {\n  for (int i = 0; i \u003c= tamanhoSequencia; i++) {\n    int botaoPressionado = aguardarEntrada();\n    if (botaoPressionado != sequencia[i]) {\n      return false;\n    }\n  }\n  return true;\n}\n\nint aguardarEntrada() {\n  while (true) {\n    if (digitalRead(botaoVerde) == LOW) return 0;\n    if (digitalRead(botaoVermelho) == LOW) return 1;\n    if (digitalRead(botaoAmarelo) == LOW) return 2;\n    if (digitalRead(botaoAzul) == LOW) return 3;\n  }\n}\n\nvoid jogoPerdido() {\n  for (int i = 0; i \u003c 3; i++) {\n    digitalWrite(ledVermelho, HIGH);\n    tone(buzzer, 500);\n    delay(300);\n    digitalWrite(ledVermelho, LOW);\n    noTone(buzzer);\n    delay(300);\n  }\n  tamanhoSequencia = 0;  // Reinicia o jogo\n  jogador = 2;  // Alterna para o modo 2 jogadores\n}\n\nvoid modo2Jogadores() {\n  // Lógica do jogo para 2 jogadores\n  Serial.println(\"Modo 2 Jogadores\");\n\n  // Similar à lógica de modo memória, mas alternando os jogadores\n  if (jogador == 1) {\n    // Jogador 1 joga\n    if (!verificarSequencia()) {\n      Serial.println(\"Jogador 1 perdeu!\");\n      jogador = 2;\n    }\n  } else {\n    // Jogador 2 joga\n    if (!verificarSequencia()) {\n      Serial.println(\"Jogador 2 perdeu!\");\n      jogador = 1;\n    }\n  }\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurtaveira%2Farduinoproject-geniusgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurtaveira%2Farduinoproject-geniusgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurtaveira%2Farduinoproject-geniusgame/lists"}