Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI
Diff: main.cpp
- Revision:
- 7:4aec4a6acac2
- Parent:
- 6:17e0520e346f
- Child:
- 8:7f7c0b94815f
- Child:
- 9:df3bff3a0b76
diff -r 17e0520e346f -r 4aec4a6acac2 main.cpp
--- a/main.cpp Thu Feb 06 07:43:10 2014 +0000
+++ b/main.cpp Thu Feb 06 08:37:47 2014 +0000
@@ -18,6 +18,7 @@
DigitalIn key[9] = {p22, p23, p24, p25, p26, p27, p28, p29, p30}; //inputit
int input = 0;
+int i;
int painetut_nappaimet[9] = {0};
@@ -29,10 +30,41 @@
for (i = 0; i<10; i++) { //draw buttons
tft.locate(10,50);
printf("Shift");
+ buttons(i, color);
}
}
+void nine_keys(void)
+{
+
+ // Tallentaa pitchin
+
+
+ // Tallentaa painallukset
+ for (i = 0; i < 9; i++) {
+ if (input = key[i].read())
+ painetut_nappaimet[i] = 1;
+ }
+ // Lähettään painallusten perusteella midimessagen
+ for (i = 0; i < 9; i++) {
+ if (painetut_nappaimet[i])
+ //midi.write(MIDIMessage::Noteon(48 + i));
+ // Debuggaus puttyyn
+ pc.printf("Digital input %d", i); //terminal viesti
+
+ pc.printf(": %d\n\r", key[i].read());
+ }
+
+
+ // Lopettaa midimessagen lähettämisen
+ for (i = 0; i < 9; i++) {
+ if (painetut_nappaimet[i])
+ wait(0.000001);//midi.write(MIDIMessage::NoteOff(48 + i));
+ }
+}
+
+
int main()
{
@@ -89,41 +121,21 @@
tft.locate(210,12);
printf("%3d",p.y);
+ light_pressed(Red,p);
+
tft.locate(160, 0);
printf("%i", Octave);
tft.locate(160, 12);
printf("%i", slider);
-
+
- }
- }
-
- while (1) {
- // Tallentaa pitchin
-
- // Tallentaa painallukset
- for (i = 0; i < 9; i++) {
- if (input = key[i].read())
- painetut_nappaimet[i] = 1;
+ nine_keys();
}
- // Lähettään painallusten perusteella midimessagen
- for (i = 0; i < 9; i++) {
- if (painetut_nappaimet[i])
- //midi.write(MIDIMessage::Noteon(48 + i));
- // Debuggaus puttyyn
- pc.printf("Digital input %d", i); //terminal viesti
- pc.printf(": %d\n\r", key[i].read());
- }
- // Lopettaa midimessagen lähettämisen
- for (i = 0; i < 9; i++) {
- if (painetut_nappaimet[i])
- wait(1);//midi.write(MIDIMessage::NoteOff(48 + i));
- }
+
+ nine_keys();
+
}
-
-
-
}
