
Simon: A Memory Game
Dependencies: 4DGL-uLCD-SE PinDetect mbed
Speaker.h
- Committer:
- cmathis
- Date:
- 2014-10-21
- Revision:
- 2:c92f0e749b94
- Parent:
- 0:64ea583d77e2
File content as of revision 2:c92f0e749b94:
#include "mbed.h" class Speaker { public: Speaker(PinName pin) : _pin(pin) { // _pin(pin) means pass pin to the Speaker Constructor } // class method to play a note based on PwmOut class void PlayNote(float frequency, float duration, float volume) { _pin.period(1.0/frequency); _pin = volume/2.0; wait(duration); _pin = 0.0; } private: // sets up specified pin for PWM using PwmOut class PwmOut _pin; };