Pololu3piPlus32U4 library
|
Plays beeps and music on the buzzer on the 3pi+ 32U4. More...
#include <Pololu3piPlus32U4Buzzer.h>
Static Public Member Functions | |
static void | playFrequency (unsigned int freq, unsigned int duration, unsigned char volume) |
static void | playNote (unsigned char note, unsigned int duration, unsigned char volume) |
static void | play (const char *sequence) |
static void | playFromProgramSpace (const char *sequence) |
static void | playMode (unsigned char mode) |
static unsigned char | playCheck () |
static unsigned char | isPlaying () |
static void | stopPlaying () |
Plays beeps and music on the buzzer on the 3pi+ 32U4.
This class uses Timer 4 and pin 6 (PD7/OC4D) to play beeps and melodies on the 3pi+ 32U4 buzzer.
Note durations are timed using a timer overflow interrupt (TIMER4_OVF
), which will briefly interrupt execution of your main program at the frequency of the sound being played. In most cases, the interrupt-handling routine is very short (several microseconds). However, when playing a sequence of notes in PLAY_AUTOMATIC
mode (the default mode) with the play()
command, this interrupt takes much longer than normal (perhaps several hundred microseconds) every time it starts a new note. It is important to take this into account when writing timing-critical code.
Definition at line 25 of file Pololu3piPlus32U4Buzzer.h.