Example program to do a frequency sweep on the speaker

Dependencies:   mbed

Fork of app-board-Speaker by Chris Styles

main.cpp

Committer:
chris
Date:
2014-08-01
Revision:
4:b141db62c34a
Parent:
3:3bb3e6051175

File content as of revision 4:b141db62c34a:

#include "mbed.h"

DigitalIn fire(D4);
PwmOut spkr(D6);

int main()
{
    while (1) {
        for (float i=2000.0; i<10000.0; i+=100) {
            spkr.period(1.0/i);
            spkr=0.5;
            wait(0.02);
        }
        spkr=0.0;
        while(!fire) {}
    }
}