User Manual

3. OrangutanBuzzerExample3
Demonstrates the use of this library’s playMode() and playCheck() methods. In this example,
automatic play mode is used to allow the melody to keep playing while it blinks the red user LED. Then
the mode is switched to play-check mode during a phase where we are trying to accurately measure
time. There are three #define macros that allow you to run this example in different ways and observe
the result. Please see the comments at the top of the sketch for more detailed information.
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
}
if (button == MIDDLE_BUTTON)
{
buzzer.play("! V8 cdefgab>cbagfedc");
lcd.print("C Major");
lcd.gotoXY(0, 1);
lcd.print("RAM ->");
}
if (button == BOTTOM_BUTTON)
{
if (buzzer.isPlaying())
{
buzzer.stopPlaying();
lcd.print("stopped");
}
else
{
buzzer.playNote(NOTE_A(5), 200, 15);
lcd.print("note A5");
}
}
}
Programming Orangutans and the 3pi Robot from the Arduino
Environment
© 2001–2019 Pololu
Corporation
5. Arduino Libraries for the Orangutan and 3pi Robot Page 43 of 66