|
@@ -30,17 +30,17 @@
|
30
|
30
|
|
31
|
31
|
int
|
32
|
32
|
main(int argc, char **argv) {
|
|
33
|
+ //! [Interesting]
|
33
|
34
|
int chord[] = { DO, RE, MI, FA, SOL, LA, SI, DO, SI };
|
34
|
35
|
|
35
|
|
- //! [Interesting]
|
36
|
36
|
// create Buzzer instance
|
37
|
37
|
upm::Buzzer* sound = new upm::Buzzer(5);
|
38
|
38
|
// print sensor name
|
39
|
39
|
std::cout << sound->name() << std::endl;
|
40
|
|
- // play sound (DO, RE, ME, etc...)
|
41
|
40
|
|
|
41
|
+ // play sound (DO, RE, MI, etc...), pausing for 0.1 seconds between notes
|
42
|
42
|
for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
|
43
|
|
- // play one second for each chord
|
|
43
|
+ // play each note for one second
|
44
|
44
|
std::cout << sound->playSound(chord[chord_ind], 1000000) << std::endl;
|
45
|
45
|
usleep(100000);
|
46
|
46
|
}
|