mX mbed BaseBoard buzzer

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ashwin_athani
Date:
Wed Dec 08 06:22:00 2010 +0000
Commit message:

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 08 06:22:00 2010 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+PwmOut buzzer(p24);
+
+int main() 
+{
+    buzzer.period(0.020);          // a 20ms period
+    while (1) 
+    {
+        for(float offset=0.0; offset<0.001; offset+=0.0001)
+        {
+            buzzer.pulsewidth(0.001 + offset); //  a pulsewidth between 1-2ms
+            wait(0.25);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Dec 08 06:22:00 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e