Example program to do a frequency sweep on the speaker

Fork of app-shield-speaker by Chris Styles

main.cpp

Committer:
sarahmarshy
Date:
2017-09-19
Revision:
5:aba9347842e0
Parent:
3:3bb3e6051175

File content as of revision 5:aba9347842e0:

#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) {}
    }
}