);
-}
\ No newline at end of file
+}
diff --git a/src/pages/Snake.tsx b/src/pages/Snake.tsx
new file mode 100644
index 0000000..65e3ced
--- /dev/null
+++ b/src/pages/Snake.tsx
@@ -0,0 +1,41 @@
+import { Header } from "@/components/Header";
+import { useConnection } from "@/contexts/ConnectionContext";
+import { useEffect } from "react";
+
+export default function Snake() {
+ const { sendCommand } = useConnection();
+
+ // useEffect para controlar o início e o fim do jogo
+ useEffect(() => {
+ // Função a ser executada quando o componente é montado (entra na tela)
+ const startGame = async () => {
+ console.log("Iniciando o jogo Snake...");
+ await sendCommand("snake_start()");
+ };
+
+ startGame();
+
+ // Função de limpeza a ser executada quando o componente é desmontado (sai da tela)
+ return () => {
+ console.log("Parando o jogo Snake...");
+ sendCommand("snake_stop()");
+ };
+ }, [sendCommand]); // A dependência garante que a função sendCommand esteja disponível
+
+ return (
+
+
+
+
+ Jogo da cobrinha em andamento
+
+
+ Mexa-se com o joystick
+
+
+ Pressione o joystick para reiniciar
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/utils/buzzersController.ts b/src/utils/buzzersController.ts
index 0cb16e9..34b012d 100644
--- a/src/utils/buzzersController.ts
+++ b/src/utils/buzzersController.ts
@@ -7,6 +7,7 @@ export interface BuzzersData {
}
export class BuzzersController {
+
private sendCommand: (command: string) => Promise;
private isSetupDone: boolean = false;
diff --git a/src/utils/playbackBuzzer.ts b/src/utils/playbackBuzzer.ts
index 2f0359f..530bd08 100644
--- a/src/utils/playbackBuzzer.ts
+++ b/src/utils/playbackBuzzer.ts
@@ -33,4 +33,8 @@ export async function playbackBuzzerSequence(
console.log('Tempo real para parar nota:', endTime - startTime, 'ms');
}
}
+
+ // Garantir que o buzzer está parado no final
+ console.log("🎼 Reprodução finalizada - garantindo que buzzer está parado");
+ await controller.stopBuzzer(0);
}
\ No newline at end of file