the most basic and simplest possible one octave midi controller. this is just to demonstrate the awesomeness of MIDI library and to show how easy it is to make a basic midi controller in just half an hour. more advanced versions coming soon :) YOUTUBE link: http://youtu.be/6qNmku_InRI Peace,

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
AliBros
Date:
Sun Jan 30 02:19:25 2011 +0000
Commit message:

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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/TextLCD.lib	Sun Jan 30 02:19:25 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jan 30 02:19:25 2011 +0000
@@ -0,0 +1,166 @@
+/*Version 0.01 of my midi controller
+Basic midi keyboard using  11 push
+ button to represent C0-B0.
+ Problems:
+ .:B0 sounds weird! and I can't understand why!
+ .:no polyphony for now!!
+ 
+ ********************************************************************************
+
+WARNING: Use at your own risk, sadly this software comes with no guarantees.
+This software is provided 'free' and in good faith, but the author does not
+accept liability for any damage arising from its use.
+
+********************************************************************************
+Ali Bros
+ 
+ */
+ 
+ 
+ 
+
+
+
+#include "mbed.h"
+#include "MIDI.h"
+#include "TextLCD.h"
+MIDI midi(p13, p14);
+DigitalIn C(p21);
+DigitalIn CSh(p22);
+DigitalIn D(p23);
+DigitalIn DSh(p24);
+DigitalIn E(p25);
+DigitalIn F(p26);
+DigitalIn FSh(p27);
+DigitalIn G(p28);
+DigitalIn GSh(p29);
+DigitalIn A(p30);
+DigitalIn ASh(p11);
+DigitalIn B(p12);
+
+//DigitalOut led1(p25);
+//DigitalOut led2(p26);
+//DigitalOut led3(p27);
+//DigitalOut led4(p28);
+TextLCD lcd(p15, p16, p17, p18, p19, p20);
+int main() {
+int octave=12;
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("MIDI SEND:");
+ lcd.locate(0,1);
+ lcd.printf("Note:");
+ while(1){
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+
+  if (C)
+   {
+    lcd.locate(8,1);
+    lcd.printf("C0 ");
+    midi.noteon(48 + octave);
+    while(C);
+    midi.noteoff(48 + octave);
+   }
+   midi.noteoff(48 + octave);
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+midi.noteoff(48 + octave);
+   if (CSh)
+   {
+    lcd.locate(8,1);
+    lcd.printf("C#0");
+    midi.noteon(49 + octave);
+    while(CSh);
+    midi.noteoff(49 + octave);
+   }   
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (D)
+   {
+    lcd.locate(8,1);
+    lcd.printf("D0 ");
+    midi.noteon(50 + octave);
+    while(D);
+    midi.noteoff(50 + octave);
+   }
+   midi.noteoff(50 + octave);
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (DSh)
+   {
+    lcd.locate(8,1);
+    lcd.printf("D#0");
+    midi.noteon(51 + octave);
+    while(DSh);
+    midi.noteoff(51 + octave);
+   } 
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (E)
+   {
+    lcd.locate(8,1);
+    lcd.printf("E0 ");
+    midi.noteon(52 + octave);
+    while(E);
+    midi.noteoff(52 + octave);
+   } 
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (F)
+   {
+    lcd.locate(8,1);
+    lcd.printf("F0 ");
+    midi.noteon(53 + octave);
+    while(F);
+    midi.noteoff(53 + octave);
+   }
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (FSh)
+   {
+    lcd.locate(8,1);
+    lcd.printf("F#0");
+    midi.noteon(54 + octave);
+    while(FSh);
+    midi.noteoff(54 + octave);
+   }
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (G)
+   {
+    lcd.locate(8,1);
+    lcd.printf("G0 ");
+    midi.noteon(55 + octave);
+    while(G);
+    midi.noteoff(55 + octave);
+   }
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (GSh)
+   {
+    lcd.locate(8,1);
+    lcd.printf("G#0");
+    midi.noteon(56 + octave);
+    while(GSh);
+    midi.noteoff(56 + octave);
+   }
+while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (A)
+   {
+    lcd.locate(8,1);
+    lcd.printf("A0 ");
+    midi.noteon(57 + octave);
+    while(A);
+    midi.noteoff(57 + octave);
+   }  
+        while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (ASh)
+   {
+    lcd.locate(8,1);
+    lcd.printf("A#0");
+    midi.noteon(58 + octave);
+    while(ASh);
+    midi.noteoff(58 + octave);
+   }     while(!C&&!CSh&&!D&&!DSh&&!E&&!F&&!FSh&&!G&&!GSh&&!A&&!ASh&&!B);
+   if (B)
+   {
+    lcd.locate(8,1);
+    lcd.printf("B0 ");
+    midi.noteon(59 + octave);
+    while(DSh);
+    midi.noteoff(59 + octave);
+   }
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jan 30 02:19:25 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1