From f2ba4556c819cadb44dc934a39bd8b1ff8845301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Kub=C3=AD=C4=8Dek?= Date: Mon, 8 Jun 2026 09:49:49 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1n=C3=AD=20zvuku=20do=20bzu=C4=8D?= =?UTF-8?q?=C3=A1ku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/src/main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/src/main.cpp b/src/src/main.cpp index 893eb19..3f8edd6 100644 --- a/src/src/main.cpp +++ b/src/src/main.cpp @@ -2,7 +2,6 @@ #include #include #include -#include // piny constexpr byte ENCODER_CLK_PIN = 11; // pwm pin, ale nepoužívá se @@ -38,14 +37,20 @@ void CloseLock() { // chování bzučáku void OpenSound() { - // TODO: melodie při otevření + int melody[] = { 262, 330, 392, 523 }; // C4, E4, G4, C5 + int durations[] = { 150, 150, 150, 300 }; + + for (int i = 0; i < 4; i++) { + tone(BUZZER_PIN, melody[i], durations[i]); + delay(durations[i] + 30); + } + noTone(BUZZER_PIN); } void CloseSound() { - // TODO: ověřit tento zvuk - digitalWrite(BUZZER_PIN, HIGH); - delay(100); - digitalWrite(BUZZER_PIN, LOW); + tone(BUZZER_PIN, 262, 150); + delay(500); + noTone(BUZZER_PIN); } // chování RGB LED