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.
Dependencies: mbed
main.cpp@0:80071421e22f, 2017-09-23 (annotated)
- Committer:
- davey
- Date:
- Sat Sep 23 17:51:37 2017 +0000
- Revision:
- 0:80071421e22f
ex6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davey | 0:80071421e22f | 1 | #include "mbed.h" |
davey | 0:80071421e22f | 2 | |
davey | 0:80071421e22f | 3 | DigitalOut speaker(p26); // use onboard loudspeaker #1 |
davey | 0:80071421e22f | 4 | |
davey | 0:80071421e22f | 5 | |
davey | 0:80071421e22f | 6 | int main() { |
davey | 0:80071421e22f | 7 | |
davey | 0:80071421e22f | 8 | |
davey | 0:80071421e22f | 9 | while(1) { //starts indefinite loop |
davey | 0:80071421e22f | 10 | speaker = 1; //turns on loudspeaker |
davey | 0:80071421e22f | 11 | wait(0.001); //for frequency 500Hz |
davey | 0:80071421e22f | 12 | speaker = 0; //turns off loudspeaker |
davey | 0:80071421e22f | 13 | wait(0.001); //for frequency 500Hz |
davey | 0:80071421e22f | 14 | } |
davey | 0:80071421e22f | 15 | } |