Viking Skull Lamp  V1.0.1
Loading...
Searching...
No Matches
buzzerControl.hpp File Reference
#include "Arduino.h"
#include "menu.hpp"

Go to the source code of this file.

Macros

#define SPEAKER_PIN   9
 The speaker is connected to pin 9 on the Arduino. More...
 
#define BUTTON_CLICK_FREQUENCY   1000
 Tone frequency for button click event. More...
 
#define BUTTON_CLICK_DURATION   20
 Tone duration for button click event. More...
 
#define ENCODER_ROTATE_FREQUENCY   5000
 Tone frequency for encoder rotate event. More...
 
#define ENCODER_ROTATE_DURATION   15
 Tone duration for encoder rotate event. More...
 
#define TURN_ON_SOUND_FREQUENCY   1800
 Tone frequency for turn on event. More...
 
#define TURN_ON_SOUND_DURATION   30
 Tone duration for turn on event. More...
 
#define NOTE_B0   31
 
#define NOTE_C1   33
 
#define NOTE_CS1   35
 
#define NOTE_D1   37
 
#define NOTE_DS1   39
 
#define NOTE_E1   41
 
#define NOTE_F1   44
 
#define NOTE_FS1   46
 
#define NOTE_G1   49
 
#define NOTE_GS1   52
 
#define NOTE_A1   55
 
#define NOTE_AS1   58
 
#define NOTE_B1   62
 
#define NOTE_C2   65
 
#define NOTE_CS2   69
 
#define NOTE_D2   73
 
#define NOTE_DS2   78
 
#define NOTE_E2   82
 
#define NOTE_F2   87
 
#define NOTE_FS2   93
 
#define NOTE_G2   98
 
#define NOTE_GS2   104
 
#define NOTE_A2   110
 
#define NOTE_AS2   117
 
#define NOTE_B2   123
 
#define NOTE_C3   131
 
#define NOTE_CS3   139
 
#define NOTE_D3   147
 
#define NOTE_DS3   156
 
#define NOTE_E3   165
 
#define NOTE_F3   175
 
#define NOTE_FS3   185
 
#define NOTE_G3   196
 
#define NOTE_GS3   208
 
#define NOTE_A3   220
 
#define NOTE_AS3   233
 
#define NOTE_B3   247
 
#define NOTE_C4   262
 
#define NOTE_CS4   277
 
#define NOTE_D4   294
 
#define NOTE_DS4   311
 
#define NOTE_E4   330
 
#define NOTE_F4   349
 
#define NOTE_FS4   370
 
#define NOTE_G4   392
 
#define NOTE_GS4   415
 
#define NOTE_A4   440
 
#define NOTE_AS4   466
 
#define NOTE_B4   494
 
#define NOTE_C5   523
 
#define NOTE_CS5   554
 
#define NOTE_D5   587
 
#define NOTE_DS5   622
 
#define NOTE_E5   659
 
#define NOTE_F5   698
 
#define NOTE_FS5   740
 
#define NOTE_G5   784
 
#define NOTE_GS5   831
 
#define NOTE_A5   880
 
#define NOTE_AS5   932
 
#define NOTE_B5   988
 
#define NOTE_C6   1047
 
#define NOTE_CS6   1109
 
#define NOTE_D6   1175
 
#define NOTE_DS6   1245
 
#define NOTE_E6   1319
 
#define NOTE_F6   1397
 
#define NOTE_FS6   1480
 
#define NOTE_G6   1568
 
#define NOTE_GS6   1661
 
#define NOTE_A6   1760
 
#define NOTE_AS6   1865
 
#define NOTE_B6   1976
 
#define NOTE_C7   2093
 
#define NOTE_CS7   2217
 
#define NOTE_D7   2349
 
#define NOTE_DS7   2489
 
#define NOTE_E7   2637
 
#define NOTE_F7   2794
 
#define NOTE_FS7   2960
 
#define NOTE_G7   3136
 
#define NOTE_GS7   3322
 
#define NOTE_A7   3520
 
#define NOTE_AS7   3729
 
#define NOTE_B7   3951
 
#define NOTE_C8   4186
 
#define NOTE_CS8   4435
 
#define NOTE_D8   4699
 
#define NOTE_DS8   4978
 

Functions

void buttonClickSound ()
 Generate button click sound. More...
 
void encoderRotateSound ()
 Generate encoder rotate sound. More...
 
void turnOnMelody ()
 Generate turn on sound. More...
 
void openCloseMelody ()
 Generate open-close melody. More...
 
void clapMelody ()
 Generate clap melody. More...
 

Macro Definition Documentation

◆ BUTTON_CLICK_DURATION

#define BUTTON_CLICK_DURATION   20

Tone duration for button click event.

Definition at line 42 of file buzzerControl.hpp.

◆ BUTTON_CLICK_FREQUENCY

#define BUTTON_CLICK_FREQUENCY   1000

Tone frequency for button click event.

Definition at line 40 of file buzzerControl.hpp.

◆ ENCODER_ROTATE_DURATION

#define ENCODER_ROTATE_DURATION   15

Tone duration for encoder rotate event.

Definition at line 47 of file buzzerControl.hpp.

◆ ENCODER_ROTATE_FREQUENCY

#define ENCODER_ROTATE_FREQUENCY   5000

Tone frequency for encoder rotate event.

Definition at line 45 of file buzzerControl.hpp.

◆ NOTE_A1

#define NOTE_A1   55

Definition at line 65 of file buzzerControl.hpp.

◆ NOTE_A2

#define NOTE_A2   110

Definition at line 77 of file buzzerControl.hpp.

◆ NOTE_A3

#define NOTE_A3   220

Definition at line 89 of file buzzerControl.hpp.

◆ NOTE_A4

#define NOTE_A4   440

Definition at line 101 of file buzzerControl.hpp.

◆ NOTE_A5

#define NOTE_A5   880

Definition at line 113 of file buzzerControl.hpp.

◆ NOTE_A6

#define NOTE_A6   1760

Definition at line 125 of file buzzerControl.hpp.

◆ NOTE_A7

#define NOTE_A7   3520

Definition at line 137 of file buzzerControl.hpp.

◆ NOTE_AS1

#define NOTE_AS1   58

Definition at line 66 of file buzzerControl.hpp.

◆ NOTE_AS2

#define NOTE_AS2   117

Definition at line 78 of file buzzerControl.hpp.

◆ NOTE_AS3

#define NOTE_AS3   233

Definition at line 90 of file buzzerControl.hpp.

◆ NOTE_AS4

#define NOTE_AS4   466

Definition at line 102 of file buzzerControl.hpp.

◆ NOTE_AS5

#define NOTE_AS5   932

Definition at line 114 of file buzzerControl.hpp.

◆ NOTE_AS6

#define NOTE_AS6   1865

Definition at line 126 of file buzzerControl.hpp.

◆ NOTE_AS7

#define NOTE_AS7   3729

Definition at line 138 of file buzzerControl.hpp.

◆ NOTE_B0

#define NOTE_B0   31

Definition at line 55 of file buzzerControl.hpp.

◆ NOTE_B1

#define NOTE_B1   62

Definition at line 67 of file buzzerControl.hpp.

◆ NOTE_B2

#define NOTE_B2   123

Definition at line 79 of file buzzerControl.hpp.

◆ NOTE_B3

#define NOTE_B3   247

Definition at line 91 of file buzzerControl.hpp.

◆ NOTE_B4

#define NOTE_B4   494

Definition at line 103 of file buzzerControl.hpp.

◆ NOTE_B5

#define NOTE_B5   988

Definition at line 115 of file buzzerControl.hpp.

◆ NOTE_B6

#define NOTE_B6   1976

Definition at line 127 of file buzzerControl.hpp.

◆ NOTE_B7

#define NOTE_B7   3951

Definition at line 139 of file buzzerControl.hpp.

◆ NOTE_C1

#define NOTE_C1   33

Definition at line 56 of file buzzerControl.hpp.

◆ NOTE_C2

#define NOTE_C2   65

Definition at line 68 of file buzzerControl.hpp.

◆ NOTE_C3

#define NOTE_C3   131

Definition at line 80 of file buzzerControl.hpp.

◆ NOTE_C4

#define NOTE_C4   262

Definition at line 92 of file buzzerControl.hpp.

◆ NOTE_C5

#define NOTE_C5   523

Definition at line 104 of file buzzerControl.hpp.

◆ NOTE_C6

#define NOTE_C6   1047

Definition at line 116 of file buzzerControl.hpp.

◆ NOTE_C7

#define NOTE_C7   2093

Definition at line 128 of file buzzerControl.hpp.

◆ NOTE_C8

#define NOTE_C8   4186

Definition at line 140 of file buzzerControl.hpp.

◆ NOTE_CS1

#define NOTE_CS1   35

Definition at line 57 of file buzzerControl.hpp.

◆ NOTE_CS2

#define NOTE_CS2   69

Definition at line 69 of file buzzerControl.hpp.

◆ NOTE_CS3

#define NOTE_CS3   139

Definition at line 81 of file buzzerControl.hpp.

◆ NOTE_CS4

#define NOTE_CS4   277

Definition at line 93 of file buzzerControl.hpp.

◆ NOTE_CS5

#define NOTE_CS5   554

Definition at line 105 of file buzzerControl.hpp.

◆ NOTE_CS6

#define NOTE_CS6   1109

Definition at line 117 of file buzzerControl.hpp.

◆ NOTE_CS7

#define NOTE_CS7   2217

Definition at line 129 of file buzzerControl.hpp.

◆ NOTE_CS8

#define NOTE_CS8   4435

Definition at line 141 of file buzzerControl.hpp.

◆ NOTE_D1

#define NOTE_D1   37

Definition at line 58 of file buzzerControl.hpp.

◆ NOTE_D2

#define NOTE_D2   73

Definition at line 70 of file buzzerControl.hpp.

◆ NOTE_D3

#define NOTE_D3   147

Definition at line 82 of file buzzerControl.hpp.

◆ NOTE_D4

#define NOTE_D4   294

Definition at line 94 of file buzzerControl.hpp.

◆ NOTE_D5

#define NOTE_D5   587

Definition at line 106 of file buzzerControl.hpp.

◆ NOTE_D6

#define NOTE_D6   1175

Definition at line 118 of file buzzerControl.hpp.

◆ NOTE_D7

#define NOTE_D7   2349

Definition at line 130 of file buzzerControl.hpp.

◆ NOTE_D8

#define NOTE_D8   4699

Definition at line 142 of file buzzerControl.hpp.

◆ NOTE_DS1

#define NOTE_DS1   39

Definition at line 59 of file buzzerControl.hpp.

◆ NOTE_DS2

#define NOTE_DS2   78

Definition at line 71 of file buzzerControl.hpp.

◆ NOTE_DS3

#define NOTE_DS3   156

Definition at line 83 of file buzzerControl.hpp.

◆ NOTE_DS4

#define NOTE_DS4   311

Definition at line 95 of file buzzerControl.hpp.

◆ NOTE_DS5

#define NOTE_DS5   622

Definition at line 107 of file buzzerControl.hpp.

◆ NOTE_DS6

#define NOTE_DS6   1245

Definition at line 119 of file buzzerControl.hpp.

◆ NOTE_DS7

#define NOTE_DS7   2489

Definition at line 131 of file buzzerControl.hpp.

◆ NOTE_DS8

#define NOTE_DS8   4978

Definition at line 143 of file buzzerControl.hpp.

◆ NOTE_E1

#define NOTE_E1   41

Definition at line 60 of file buzzerControl.hpp.

◆ NOTE_E2

#define NOTE_E2   82

Definition at line 72 of file buzzerControl.hpp.

◆ NOTE_E3

#define NOTE_E3   165

Definition at line 84 of file buzzerControl.hpp.

◆ NOTE_E4

#define NOTE_E4   330

Definition at line 96 of file buzzerControl.hpp.

◆ NOTE_E5

#define NOTE_E5   659

Definition at line 108 of file buzzerControl.hpp.

◆ NOTE_E6

#define NOTE_E6   1319

Definition at line 120 of file buzzerControl.hpp.

◆ NOTE_E7

#define NOTE_E7   2637

Definition at line 132 of file buzzerControl.hpp.

◆ NOTE_F1

#define NOTE_F1   44

Definition at line 61 of file buzzerControl.hpp.

◆ NOTE_F2

#define NOTE_F2   87

Definition at line 73 of file buzzerControl.hpp.

◆ NOTE_F3

#define NOTE_F3   175

Definition at line 85 of file buzzerControl.hpp.

◆ NOTE_F4

#define NOTE_F4   349

Definition at line 97 of file buzzerControl.hpp.

◆ NOTE_F5

#define NOTE_F5   698

Definition at line 109 of file buzzerControl.hpp.

◆ NOTE_F6

#define NOTE_F6   1397

Definition at line 121 of file buzzerControl.hpp.

◆ NOTE_F7

#define NOTE_F7   2794

Definition at line 133 of file buzzerControl.hpp.

◆ NOTE_FS1

#define NOTE_FS1   46

Definition at line 62 of file buzzerControl.hpp.

◆ NOTE_FS2

#define NOTE_FS2   93

Definition at line 74 of file buzzerControl.hpp.

◆ NOTE_FS3

#define NOTE_FS3   185

Definition at line 86 of file buzzerControl.hpp.

◆ NOTE_FS4

#define NOTE_FS4   370

Definition at line 98 of file buzzerControl.hpp.

◆ NOTE_FS5

#define NOTE_FS5   740

Definition at line 110 of file buzzerControl.hpp.

◆ NOTE_FS6

#define NOTE_FS6   1480

Definition at line 122 of file buzzerControl.hpp.

◆ NOTE_FS7

#define NOTE_FS7   2960

Definition at line 134 of file buzzerControl.hpp.

◆ NOTE_G1

#define NOTE_G1   49

Definition at line 63 of file buzzerControl.hpp.

◆ NOTE_G2

#define NOTE_G2   98

Definition at line 75 of file buzzerControl.hpp.

◆ NOTE_G3

#define NOTE_G3   196

Definition at line 87 of file buzzerControl.hpp.

◆ NOTE_G4

#define NOTE_G4   392

Definition at line 99 of file buzzerControl.hpp.

◆ NOTE_G5

#define NOTE_G5   784

Definition at line 111 of file buzzerControl.hpp.

◆ NOTE_G6

#define NOTE_G6   1568

Definition at line 123 of file buzzerControl.hpp.

◆ NOTE_G7

#define NOTE_G7   3136

Definition at line 135 of file buzzerControl.hpp.

◆ NOTE_GS1

#define NOTE_GS1   52

Definition at line 64 of file buzzerControl.hpp.

◆ NOTE_GS2

#define NOTE_GS2   104

Definition at line 76 of file buzzerControl.hpp.

◆ NOTE_GS3

#define NOTE_GS3   208

Definition at line 88 of file buzzerControl.hpp.

◆ NOTE_GS4

#define NOTE_GS4   415

Definition at line 100 of file buzzerControl.hpp.

◆ NOTE_GS5

#define NOTE_GS5   831

Definition at line 112 of file buzzerControl.hpp.

◆ NOTE_GS6

#define NOTE_GS6   1661

Definition at line 124 of file buzzerControl.hpp.

◆ NOTE_GS7

#define NOTE_GS7   3322

Definition at line 136 of file buzzerControl.hpp.

◆ SPEAKER_PIN

#define SPEAKER_PIN   9

The speaker is connected to pin 9 on the Arduino.

Definition at line 37 of file buzzerControl.hpp.

◆ TURN_ON_SOUND_DURATION

#define TURN_ON_SOUND_DURATION   30

Tone duration for turn on event.

Definition at line 52 of file buzzerControl.hpp.

◆ TURN_ON_SOUND_FREQUENCY

#define TURN_ON_SOUND_FREQUENCY   1800

Tone frequency for turn on event.

Definition at line 50 of file buzzerControl.hpp.

Function Documentation

◆ buttonClickSound()

void buttonClickSound ( )

Generate button click sound.

This function generates the button click sound effect on the buzzer.

See also
BUTTON_CLICK_FREQUENCY
BUTTON_CLICK_DURATION

Definition at line 32 of file buzzerControl.cpp.

Here is the caller graph for this function:

◆ clapMelody()

void clapMelody ( )

Generate clap melody.

This function generates the clap melody on the buzzer.

Definition at line 81 of file buzzerControl.cpp.

Here is the caller graph for this function:

◆ encoderRotateSound()

void encoderRotateSound ( )

Generate encoder rotate sound.

This function generates the encoder rotate sound effect on the buzzer.

See also
ENCODER_ROTATE_FREQUENCY
ENCODER_ROTATE_DURATION

Definition at line 44 of file buzzerControl.cpp.

Here is the caller graph for this function:

◆ openCloseMelody()

void openCloseMelody ( )

Generate open-close melody.

This function generates the open-close melody on the buzzer.

Definition at line 56 of file buzzerControl.cpp.

Here is the caller graph for this function:

◆ turnOnMelody()

void turnOnMelody ( )

Generate turn on sound.

This function generates the turn on sound effect on the buzzer.

Note
Originally it was a melody( this is why the name ), but I
ran out of memory, so I had to optimize out things.
See also
TURN_ON_SOUND_FREQUENCY
TURN_ON_SOUND_DURATION

Definition at line 106 of file buzzerControl.cpp.

Here is the caller graph for this function: