pololu / pololu-buzzer-arduino

C++ library for the Arduino IDE that allows you to play notes and songs on a buzzer.
MIT License
6 stars 4 forks source link

add playFrequency callback and example #1

Open wmacevoy opened 9 years ago

wmacevoy commented 9 years ago

Adding the callback makes this code much more flexible; I needed it to control the power of an LED in sync with the playback of music; I think others will like this feature. It is possible the playFrequency should be called at the end of a play() or for a pause with a frequency of 0 to terminate the song; I did not add this callback; but it would make the end of a song more consistent. The example illustrates the idea.

Thanks for the very useful functionality to start from.