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.
main.cpp
- Committer:
- BertieHarte
- Date:
- 2019-07-28
- Revision:
- 0:5742b01051e5
- Child:
- 1:760c5b759868
File content as of revision 0:5742b01051e5:
#include "mbed.h"
DigitalIn fire(p14); // centre pin of joystick.
PwmOut spkr(p26); // speaker output
int main() {
    while(1) {
        for (float i=2000.0; i<10000; i+=100) { // increment i by 200 each loop if the value at teh start of the loo is less than 1000
            spkr.period(1.0/i);
            spkr=0.5;
            wait(0.1);
    }
    spkr=0.0;
    while(!fire) {}
    }
}