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
Fork of mbed_blinky by
Revision 7:20b5bef5d206, committed 2014-11-18
- Comitter:
- f3d
- Date:
- Tue Nov 18 12:30:47 2014 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- v1
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri May 09 19:58:03 2014 +0300
+++ b/main.cpp Tue Nov 18 12:30:47 2014 +0000
@@ -1,12 +1,25 @@
#include "mbed.h"
-DigitalOut myled(LED1);
+DigitalOut speaker(D2);
+void tone(float freq, float len)
+{
+ float half_cycle;
+ int cyclecount;
+ half_cycle=(1.0/freq)/2.0;
+ cyclecount=freq*len;
+ while(cyclecount--)
+ {
+ speaker=1;
+ wait(half_cycle);
+ speaker=0;
+ wait(half_cycle);
+ }
+}
int main() {
while(1) {
- myled = 1;
- wait(0.2);
- myled = 0;
- wait(0.2);
+
+ tone(261,0.5);
+ wait(0.5);
}
}
--- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Tue Nov 18 12:30:47 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file
