An example program for the mbed application board that exercises the speaker

Dependencies:   mbed

Fork of app-board-RGB by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalIn fire(p14);
00004 PwmOut spkr(p26);
00005 
00006 int main()
00007 {
00008     while (1) {
00009         for (float i=2000.0; i<10000.0; i+=100) {
00010             spkr.period(1.0/i);
00011             spkr=0.5;
00012             wait(0.1);
00013         }
00014         spkr=0.0;
00015         while(!fire) {}
00016     }
00017 }