-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound.ino
94 lines (90 loc) · 1.92 KB
/
sound.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "Dot.h"
const int doremi[] = {262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988, 1047};
void sound(uint8_t part) {
if (part==BUTTON_A) {
tone(SPEAKER, doremi[5]);
delay(20);
}
else if (part==BUTTON_B) {
tone(SPEAKER, doremi[20]);
delay(35);
tone(SPEAKER, doremi[18]);
delay(15);
}
else if (part==BUTTON_C) {
tone(SPEAKER, doremi[18]);
delay(35);
tone(SPEAKER, doremi[20]);
delay(35);
tone(SPEAKER, doremi[22]);
delay(35);
}
else if (part==VOLUME) {
tone(SPEAKER, doremi[2]);
delay(1);
}
}
void fanfare() {
delay(500);
tone(SPEAKER, doremi[12]);
delay(375/3);
noTone(SPEAKER);
delay(5);
tone(SPEAKER, doremi[12]);
delay(375/3);
noTone(SPEAKER);
delay(5);
tone(SPEAKER, doremi[12]);
delay(375/3);
noTone(SPEAKER);
delay(5);
tone(SPEAKER, doremi[12]);
delay(375);
tone(SPEAKER, doremi[8]);
delay(375);
tone(SPEAKER, doremi[10]);
delay(375);
tone(SPEAKER, doremi[12]);
delay(100);
noTone(SPEAKER);
delay(150);
tone(SPEAKER, doremi[10]);
delay(375/3);
tone(SPEAKER, doremi[12]);
delay(375*2);
noTone(SPEAKER);
delay(10);
}
void miss() {
delay(500);
tone(SPEAKER, 150);
delay(375/2);
noTone(SPEAKER);
delay(375/2);
tone(SPEAKER, 150);
delay(375*1.5);
noTone(SPEAKER);
delay(375*1.5);
tone(SPEAKER, doremi[17]);
delay(375);
tone(SPEAKER, doremi[16]);
delay(375/2);
tone(SPEAKER, doremi[15]);
delay(375);
tone(SPEAKER, doremi[14]);
delay(375/2);
tone(SPEAKER, doremi[13]);
delay(375);
tone(SPEAKER, doremi[8]);
delay(375*1.5);
tone(SPEAKER, doremi[13]);
delay(375/2);
tone(SPEAKER, doremi[12]);
delay(375*2);
noTone(SPEAKER);
delay(375);
tone(SPEAKER, doremi[24]);
delay(375/2);
noTone(SPEAKER);
delay(10);
}