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.
BuzzMotor.h
- Committer:
- Elecia
- Date:
- 2016-05-25
- Revision:
- 1:0a051df78be2
File content as of revision 1:0a051df78be2:
#include "mbed.h"
// new class to play a pattern based on PwmOut class, based on SongPlayer: SongPlayer
// https://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/
class BuzzMotor
{
public:
BuzzMotor(PinName pin) : mPin(pin) {
// mPin(pin) means pass pin to the constructor
mPin = 0.0;
}
void On()
{
mPin = 1;
}
void Off()
{
mPin = 0;
}
private:
Timeout duration;
DigitalOut mPin;
typedef enum {RUMBLE=0, ONE_SEC_HIGH_TICK=1, ONE_SEC_LOW_TICK=2, QUIET=3 } eBuzzType;
};