Real Time Lab Program

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
robt
Date:
Sun Jan 25 16:27:11 2015 +0000
Commit message:
Real Time Lab Program

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	Sun Jan 25 16:27:11 2015 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+PwmOut buzzer(p25);
+
+//frequency array
+float frequency[]= {659,554,659,554,440,494,554,587,494,659,554,440};
+//beat array
+float beat[]= {1,1,1,1,1,0.5,0.5,1,1,1,1,2};   
+
+
+          
+int main()
+{
+    while (1) {
+        for (int i=0; i<=11; i++) {
+            buzzer.period(1/(frequency[i]));               // set PWM period
+            buzzer=0.5;                                    // set duty cycle
+            wait(beat[i]);                                 // hold for beat period
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jan 25 16:27:11 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file