Viking Skull Lamp  V1.0.1
Loading...
Searching...
No Matches
buzzerControl.cpp
Go to the documentation of this file.
1/*
2 * Created on May 28 2022
3 *
4 * Copyright (c) 2022 - Daniel Hajnal
5 * hajnal.daniel96@gmail.com
6 * This file is part of the Viking Skull Lamp project.
7 * Modified 2022.06.27
8*/
9
10/*
11MIT License
12Copyright (c) 2022 Daniel Hajnal
13Permission is hereby granted, free of charge, to any person obtaining a copy
14of this software and associated documentation files (the "Software"), to deal
15in the Software without restriction, including without limitation the rights
16to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17copies of the Software, and to permit persons to whom the Software is
18furnished to do so, subject to the following conditions:
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27SOFTWARE.
28*/
29
30#include "buzzerControl.hpp"
31
33
34 // Check if we are muted.
35 if( buzzerEnabled ){
36
37 // If not, make some nose.
39
40 }
41
42}
43
45
46 // Check if we are muted.
47 if( buzzerEnabled ){
48
49 // If not, make some nose.
51
52 }
53
54}
55
57
58 // Check if we are muted.
59 if( !buzzerEnabled ){
60
61 // We have to be quaiet, so return.
62 return;
63
64 }
65
66 // Play the melody.
67 tone( SPEAKER_PIN, NOTE_F3, 100 );
68 delay( 100 );
69
70 tone( SPEAKER_PIN, NOTE_GS3, 100 );
71 delay( 100 );
72
73 tone( SPEAKER_PIN, NOTE_B3, 100 );
74 delay( 100 );
75
76 tone( SPEAKER_PIN, NOTE_C3, 300 );
77 delay( 300 );
78
79}
80
82
83 // Check if we are muted.
84 if( !buzzerEnabled ){
85
86 // We have to be quaiet, so return.
87 return;
88
89 }
90
91 // Play the melody.
92 tone( SPEAKER_PIN, NOTE_C2, 50 );
93 delay( 50 );
94
95 tone( SPEAKER_PIN, NOTE_C3, 50 );
96 delay( 50 );
97
98 tone( SPEAKER_PIN, NOTE_C4, 50 );
99 delay( 50 );
100
101 tone( SPEAKER_PIN, NOTE_C5, 100 );
102 delay( 100 );
103
104}
105
107
108 // Check if we are muted.
109 if( buzzerEnabled ){
110
111 // If not, make some nose.
113
114 }
115
116}
void encoderRotateSound()
Generate encoder rotate sound.
void turnOnMelody()
Generate turn on sound.
void buttonClickSound()
Generate button click sound.
void openCloseMelody()
Generate open-close melody.
void clapMelody()
Generate clap melody.
#define NOTE_F3
#define ENCODER_ROTATE_FREQUENCY
Tone frequency for encoder rotate event.
#define NOTE_C2
#define NOTE_C5
#define BUTTON_CLICK_FREQUENCY
Tone frequency for button click event.
#define NOTE_C3
#define SPEAKER_PIN
The speaker is connected to pin 9 on the Arduino.
#define NOTE_B3
#define TURN_ON_SOUND_DURATION
Tone duration for turn on event.
#define TURN_ON_SOUND_FREQUENCY
Tone frequency for turn on event.
#define BUTTON_CLICK_DURATION
Tone duration for button click event.
#define ENCODER_ROTATE_DURATION
Tone duration for encoder rotate event.
#define NOTE_C4
#define NOTE_GS3
bool buzzerEnabled
It will store the user selected state of the buzzer.
Definition: menu.cpp:50