xd

Dependencies:   mbed

Fork of Simple_Touch_Sens by Veikko Kero

Files at this revision

API Documentation at this revision

Comitter:
tanssisatu
Date:
Thu Jan 30 06:24:52 2014 +0000
Parent:
1:7ed7d128d225
Commit message:
plob multitouch

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jan 30 06:13:55 2014 +0000
+++ b/main.cpp	Thu Jan 30 06:24:52 2014 +0000
@@ -8,11 +8,11 @@
 
 DigitalIn  key[9] = {p22, p23, p24, p25, p26, p27, p28, p29, p30};       //inputit
 int input = 0;
-int i;
+int i,j,k;
 
 Serial pc(USBTX, USBRX);
 
-//USBMIDI midi;
+USBMIDI midi;
  
 int main() {
     while (1){
@@ -39,20 +39,35 @@
 
     
         for (i=0; i<9; i++) {
-            
             input = key[i].read();
-
             if (!input) {                                     //MIDIT
                 midi.write(MIDIMessage::NoteOn(48+i));
-                wait(0.25);
-                midi.write(MIDIMessage::NoteOff(48+i));
-                wait(0.25);
+                //wait(0.25);
+                for(j=0; j<9; j++) {
+                    input = key[j].read();
+                    if (!input) {
+                        midi.write(MIDIMessage::NoteOn(48+j));
+                        //wait(0.25);
+                        for(k=0; k<9; k++) {
+                            input = key[k].read();
+                            if (!input) {
+                                midi.write(MIDIMessage::NoteOn(48+k));
+                                //wait(0.25);
+                            }
+                        }
+                    }
+                }
             }
+            midi.write(MIDIMessage::NoteOff(48+i));
+            midi.write(MIDIMessage::NoteOff(48+j));
+            midi.write(MIDIMessage::NoteOff(48+k));
             
-
+            wait(0.25);
+            
+        } 
             /* pc.printf("Digital input %d", i);               //terminal viesti
-            pc.printf(": %d\n\r", key[i].read());
-        } */
+            pc.printf(": %d\n\r", key[i].read());*/
+        
 
         /* pc.printf("\n\r");
         wait(1); */