Shai COPY OUR MIDI!!!

Dependencies:   USBDevice mbed

Fork of USBMIDI_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
yanay_amir
Date:
Mon Apr 18 08:39:47 2016 +0000
Parent:
7:78af4df7012f
Commit message:
Shai Patel Dont Copy!!!!!!

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 78af4df7012f -r c766b9842ae4 main.cpp
--- a/main.cpp	Fri Mar 01 13:25:02 2013 +0000
+++ b/main.cpp	Mon Apr 18 08:39:47 2016 +0000
@@ -2,16 +2,19 @@
 
 #include "mbed.h"
 #include "USBMIDI.h"
+USBMIDI midi;
+float frequency[]={659,554,659,554,440,494,554,587,494,659,554,440}; //frequency array 
+float beat[]=     {1,1,1,1,1,0.5,0.5,1,1,1,1,2};              //beat array
+int   midiarr[] =    {76,73,76,73,69,71,73,74,71,76,73,69};
 
-USBMIDI midi;
 
 int main() {             
     while (1) {    
-        for(int i=48; i<83; i++) {     // send some messages!
-            midi.write(MIDIMessage::NoteOn(i));
-            wait(0.25);
-            midi.write(MIDIMessage::NoteOff(i));
-            wait(0.5);
+        for(int i=0; i<12; i++) { 
+            midi.write(MIDIMessage::NoteOn(midiarr[i]));
+            wait(0.25*beat[i]);
+            midi.write(MIDIMessage::NoteOff(midiarr[i]));
+            wait(0.05);
         }
     }
 }