diff options
| author | EnricoGuccii <partyka.003@gmail.com> | 2025-05-11 19:11:37 +0200 |
|---|---|---|
| committer | EnricoGuccii <partyka.003@gmail.com> | 2025-05-11 19:11:37 +0200 |
| commit | f3a5b90d090fda687adad44e37200fa446fcf7e0 (patch) | |
| tree | b7c432c13d4427cc2622c9b149522a97db55b302 /lib/buzzer/buzzer.cpp | |
| parent | cf9a1f07ed519cadd58e38794616d0a9596be4ae (diff) | |
add motors
Diffstat (limited to 'lib/buzzer/buzzer.cpp')
| -rw-r--r-- | lib/buzzer/buzzer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/buzzer/buzzer.cpp b/lib/buzzer/buzzer.cpp index a83ec22..df67ac7 100644 --- a/lib/buzzer/buzzer.cpp +++ b/lib/buzzer/buzzer.cpp @@ -4,10 +4,15 @@ #define BUZZER_CHANNEL 3 #define BUZZER_RESOLUTION 8 +#define BUZZER_FREQ 2000 BUZZER::BUZZER() { - ledcSetup(BUZZER_CHANNEL, 2000, BUZZER_RESOLUTION); +} + +void BUZZER::init() +{ + ledcSetup(BUZZER_CHANNEL, BUZZER_FREQ, BUZZER_RESOLUTION); ledcAttachPin(BUZZER_PIN, BUZZER_CHANNEL); } @@ -23,7 +28,6 @@ void BUZZER::playTone(uint16_t frequency, uint32_t duration) void BUZZER::playMelody(const uint16_t melody[][2], size_t length) { - for (size_t i = 0; i < length; i++) { playTone(melody[i][0], melody[i][1]); |