Mbed Clock application using an NTP connection to get internet time and a terminal interface to send commands
Dependencies: 4DGL-uLCD-SE EthernetInterface NTPClient mbed-rtos mbed SDFileSystem wavfile
Speaker.h
- Committer:
- dudanian
- Date:
- 2014-12-09
- Revision:
- 6:23c3adb0470d
- Parent:
- 2:c939d0501184
File content as of revision 6:23c3adb0470d:
#include "mbed.h" // new class to play a note on Speaker based on PwmOut class class Speaker { private: // sets up specified pin for PWM using PwmOut class PwmOut pin; Ticker ticker; void flipPin() { pin = 0.0; } 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; ticker.attach(this, &Speaker::flipPin, duration); //wait(duration); //pin = 0.0; } };