working

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pstephens18
Date:
Wed Jan 20 21:45:59 2016 +0000
Commit message:
Playing a bit Fast
;

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
diff -r 000000000000 -r 962d8d826218 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 20 21:45:59 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+
+PwmOut buzzer(p21);
+BusOut led(LED1,LED2,LED3,LED4);
+float frequency[] = {622,0,784,0,880,0,622,0,784,0,923,880,0,622,0,784,0,880,0,784,0,622,0};
+float beat[] = {.5,0,.5,0,1.25,0,.5,0,.5,0,.5,1.5,0,.5,0,.5,0,1,0,.5,0,1.5,0};
+
+int main() {
+    while(1) 
+    {
+        for(int i=0; i<= 23;i++)
+        {
+            buzzer.period(4/(frequency[i]));
+            buzzer = 0.5;
+            if(frequency[i]== 622){led =1;} 
+            if(frequency[i]== 784){led =2;} 
+            if(frequency[i]== 880){led =4;}
+            if(frequency[i]== 923){led = 8;} 
+    
+            wait(0.4*beat[i]); 
+            
+            if(beat[i]==0)
+            {wait(.15);}
+          
+        }
+    }
+}
diff -r 000000000000 -r 962d8d826218 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 20 21:45:59 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file