mX mbed BaseBoard buzzer

Dependencies:   mbed

main.cpp

Committer:
ashwin_athani
Date:
2010-12-08
Revision:
0:c25709d578e5

File content as of revision 0:c25709d578e5:

#include "mbed.h"

PwmOut buzzer(p24);

int main() 
{
    buzzer.period(0.020);          // a 20ms period
    while (1) 
    {
        for(float offset=0.0; offset<0.001; offset+=0.0001)
        {
            buzzer.pulsewidth(0.001 + offset); //  a pulsewidth between 1-2ms
            wait(0.25);
        }
    }
}