Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Music.h
- Committer:
- halea
- Date:
- 2016-09-19
- Revision:
- 0:dcdfee042939
File content as of revision 0:dcdfee042939:
#include "mbed.h"
/*! Music class.
* Used for playing musical notes with the FRDM-KL46Z.
* \author Matthew Shuman
*
* \date June 9th, 2016
* \bug No bugs yet
* @code
* #include "mbed.h"
* #include "Music.h"
*
* Music mu();
*
* int main() {
* mu.playNote(2);
* }
* @endcode
*/
class Music
{
public:
/**
* @param mySpeaker selects a DigitalOut to toggle at the selected frequency (in Music.h).
*/
Music(PinName mySpeaker);
/**
* @param There is no parameter for this deconstructor.
*/
~Music(void);
/**
* @param note plays a note from the standard piano.
* Input notes range from 1 to 88.
* Set to zero to turn off the note.
* Sourced from: https://en.wikipedia.org/wiki/Piano_key_frequencies
* @returns
* 1 on success.
* 0 on error, typically outside of the max range of 88.
*/
int playNote(int note);
private:
DigitalOut _mySpeaker; //This is the private DigitalOut that toggles
//the output connect to the speaker.
}; //end of Music class