MIDIInstrumentPAD
Dependencies: mbed DISCO_F746NG_USBDevice
Revision 0:33a7ad2adf6c, committed 2019-05-14
- Comitter:
- 60010649
- Date:
- Tue May 14 15:59:23 2019 +0000
- Commit message:
- .
Changed in this revision
diff -r 000000000000 -r 33a7ad2adf6c DISCO_F746NG_USBDevice.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DISCO_F746NG_USBDevice.lib Tue May 14 15:59:23 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/DieterGraef/code/DISCO_F746NG_USBDevice/#0a2eaa300982
diff -r 000000000000 -r 33a7ad2adf6c main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 14 15:59:23 2019 +0000 @@ -0,0 +1,696 @@ +#include "mbed.h" +#include "TS_DISCO_F746NG.h" +#include "LCD_DISCO_F746NG.h" +#include "USBMIDI.h" + +#define FastSpeedInterface 0 +#define HighSpeedInterface 1 +AnalogIn v(A0); +LCD_DISCO_F746NG lcd; +TS_DISCO_F746NG ts; +Serial pc(USBTX, USBRX); +USBMIDI midi(FastSpeedInterface); +int a0=0; + + +int Y1=60; +int Yline1=131.66; +int Yline2=201.33; +int Ysize=70.66; +int o=0; +int k=12; + + + + + +int main() +{ + + top: + int a,b,c=0; + TS_StateTypeDef TS_State; + lcd.SetFont(&Font24); + lcd.Clear(LCD_COLOR_DARKGREEN); + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"SELECT",CENTER_MODE); + + + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block1 + lcd.FillRect(0,Y1,159,212); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_TRANSPARENT); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" DRUM",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); //////Block2 + lcd.FillRect(160,Y1,159,212); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"GUITAR",CENTER_MODE); + + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block3 + lcd.FillRect(320,Y1,159,212); + lcd.SetBackColor(LCD_COLOR_TRANSPARENT); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"PIANO ",RIGHT_MODE); + + wait(1); + + while(1) { + ts.GetState(&TS_State); + + if((TS_State.touchDetected)) + { + if(TS_State.touchX[0] >= 0&&TS_State.touchX[0]<160&&a==0&&b==0&&c==0) + { + + + lcd.Clear(LCD_COLOR_DARKGREEN); + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + + + + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"DRUM",CENTER_MODE); + + + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block1 + lcd.FillRect(0,60,140,Ysize); + + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)" Crash",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); //////Block2 + lcd.FillRect(140,60,140,Ysize); + + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_TRANSPARENT); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"Tom1 ",CENTER_MODE); + + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block3 + lcd.FillRect(280,60,140,Ysize); + + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"Tom2 ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block4 + lcd.FillRect(0,Yline1,140,Ysize); + + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" HHOpen",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block5 + lcd.FillRect(140,Yline1,140,Ysize); + + + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"Snare ",CENTER_MODE); + + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block6 + lcd.FillRect(280,Yline1,140,Ysize); + + + + + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"Tom3 ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block7 + lcd.FillRect(0,Yline2,140,Ysize); + + + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)" HHClose",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block8 + lcd.FillRect(140,Yline2,140,Ysize); + + + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Kick ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block9 + lcd.FillRect(280,Yline2,140,Ysize); + + + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Clap ",RIGHT_MODE); + + + lcd.SetTextColor(LCD_COLOR_BROWN); ///BlockLeftBackToMain + lcd.FillRect(420,Y1,60,212); + lcd.SetBackColor(LCD_COLOR_BROWN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"B ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"A ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"C ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"K ",RIGHT_MODE); + + + + a=1; + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<140&&TS_State.touchY[0] >= 60&&TS_State.touchY[0]<Yline1) + { + pc.printf("a"); + midi.write(MIDIMessage::NoteOn(48)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(48)); + + + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 140&&TS_State.touchX[0]<280&&TS_State.touchY[0] >= Y1&&TS_State.touchY[0]<Yline1) + { + pc.printf("b"); + midi.write(MIDIMessage::NoteOn(49)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(49)); + + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 280&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= Y1&&TS_State.touchY[0]<Yline1) + { + pc.printf("c"); + midi.write(MIDIMessage::NoteOn(50)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(50)); + } + + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<140&&TS_State.touchY[0] >= Yline1&&TS_State.touchY[0]<Yline2) + { + pc.printf("d"); + midi.write(MIDIMessage::NoteOn(51)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(51)); + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 140&&TS_State.touchX[0]<280&&TS_State.touchY[0] >= Yline1&&TS_State.touchY[0]<Yline2) + { + pc.printf("e"); + midi.write(MIDIMessage::NoteOn(52)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(52)); + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 280&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= Yline1&&TS_State.touchY[0]<Yline2) + { + pc.printf("f"); + midi.write(MIDIMessage::NoteOn(53)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(53)); + } + + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<140&&TS_State.touchY[0] >= Yline2) + { + midi.write(MIDIMessage::NoteOn(54)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(54)); + + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 140&&TS_State.touchX[0]<280&&TS_State.touchY[0] >= Yline2) + { + pc.printf("h"); + midi.write(MIDIMessage::NoteOn(57)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(57)); + + + } + else if(a==1&&b==0&&c==0&&TS_State.touchX[0] >= 280&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= Yline2) + { + pc.printf("i"); + midi.write(MIDIMessage::NoteOn(56)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(56)); + } + else if(TS_State.touchX[0] >= 420&&TS_State.touchY[0] >60&&a==1&&b==0&&c==0) + { + a = 0; + pc.printf("bye"); + goto top; + } + + else if(TS_State.touchX[0] >= 160&&TS_State.touchX[0]<320&&a==0&&b==0&&c==0) + { + lcd.Clear(LCD_COLOR_DARKGREEN); + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"Oc ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLUE); //////- + lcd.FillRect(320,0,40,60); + + lcd.SetTextColor(LCD_COLOR_WHITE); //////- + lcd.FillRect(320,20,40,10); + + lcd.SetTextColor(LCD_COLOR_BLUE); //////+ + lcd.FillRect(440,0,40,60); + + lcd.SetTextColor(LCD_COLOR_WHITE); //////- + lcd.FillRect(440,20,40,20); + lcd.FillRect(455,0,10,60); + + + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"GUITAR",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); //////Block2 + lcd.FillRect(105,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"C# ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block6 + lcd.FillRect(105,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"F ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block10 + lcd.FillRect(105,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"A ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block3 + lcd.FillRect(210,60,105,70.667); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)" D",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block7 + lcd.FillRect(210,130.66,105,70.667); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" F#",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block11 + lcd.FillRect(210,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)" Bb",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block4 + lcd.FillRect(315,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"D# ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block8 + lcd.FillRect(315,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"G ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block12 + lcd.FillRect(315,201.32,105,70.66); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"B ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block1 + lcd.FillRect(0,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)" C",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block5 + lcd.FillRect(0,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" E",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block9 + lcd.FillRect(0,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)" G#",LEFT_MODE); + + + lcd.SetTextColor(LCD_COLOR_BROWN); ///BlockLeftBackToMain + lcd.FillRect(420,Y1,60,212); + lcd.SetBackColor(LCD_COLOR_BROWN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"B ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"A ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"C ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"K ",RIGHT_MODE); + + b=1; + + midi.write(MIDIMessage::NoteOn(100)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(100)); + + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 440&&TS_State.touchX[0]<480&&TS_State.touchY[0] >= 0&&TS_State.touchY[0] < 60) + { + o=o+1; + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 320&&TS_State.touchX[0]<360&&TS_State.touchY[0] >= 0&&TS_State.touchY[0] < 60) + { + o=o-1; + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("1"); + midi.write(MIDIMessage::NoteOn(60+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(60+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("2"); + midi.write(MIDIMessage::NoteOn(61+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(61+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("3"); + midi.write(MIDIMessage::NoteOn(62+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(62+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("4"); + midi.write(MIDIMessage::NoteOn(63+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(63+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.33) + { + pc.printf("5"); + midi.write(MIDIMessage::NoteOn(64+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(64+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >= 130.66 &&TS_State.touchY[0]<201.34) + { + pc.printf("6"); + midi.write(MIDIMessage::NoteOn(65+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(65+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("7"); + midi.write(MIDIMessage::NoteOn(66+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(66+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("8"); + midi.write(MIDIMessage::NoteOn(67+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(67+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >=201.34) + { + pc.printf("9"); + midi.write(MIDIMessage::NoteOn(68+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(68+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >=201.34) + { + pc.printf("10"); + midi.write(MIDIMessage::NoteOn(69+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(69+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >=201.34) + { + pc.printf("11"); + midi.write(MIDIMessage::NoteOn(70+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(70+(k*o))); + } + else if(a==0&&b==1&&c==0&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >=201.34) + { + pc.printf("12"); + midi.write(MIDIMessage::NoteOn(71+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(71+(k*o))); + } + + + else if(TS_State.touchX[0] >= 420&&TS_State.touchY[0] >=60&&a==0&&b==1&&c==0) + { + b = 0; + pc.printf("bye2"); + midi.write(MIDIMessage::NoteOn(101)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(101)); + goto top; + + } + else if(TS_State.touchX[0] >= 320&&a==0&&b==0&&c==0) + { + lcd.Clear(LCD_COLOR_DARKGREEN); + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"Oc ",RIGHT_MODE); + lcd.SetTextColor(LCD_COLOR_BLUE); //////- + lcd.FillRect(320,0,40,60); + + lcd.SetTextColor(LCD_COLOR_WHITE); //////- + lcd.FillRect(320,20,40,10); + + lcd.SetTextColor(LCD_COLOR_BLUE); //////+ + lcd.FillRect(440,0,40,60); + + lcd.SetTextColor(LCD_COLOR_WHITE); //////- + lcd.FillRect(440,20,40,20); + lcd.FillRect(455,0,10,60); + + lcd.SetBackColor(LCD_COLOR_DARKGREEN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"PIANO",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); //////Block2 + lcd.FillRect(105,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"C# ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block6 + lcd.FillRect(105,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"F ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block10 + lcd.FillRect(105,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"A ",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block3 + lcd.FillRect(210,60,105,70.667); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)" D",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block7 + lcd.FillRect(210,130.66,105,70.667); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" F#",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block11 + lcd.FillRect(210,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)" Bb",CENTER_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block4 + lcd.FillRect(315,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"D# ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block8 + lcd.FillRect(315,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"G ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block12 + lcd.FillRect(315,201.32,105,70.66); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"B ",RIGHT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block1 + lcd.FillRect(0,60,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)" C",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_BLACK); ///Block5 + lcd.FillRect(0,130.66,105,70.667); + lcd.SetBackColor(LCD_COLOR_BLACK); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)" E",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_WHITE); ///Block9 + lcd.FillRect(0,201.32,105,70.667); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)" G#",LEFT_MODE); + + lcd.SetTextColor(LCD_COLOR_BROWN); ///BlockLeftBackToMain + lcd.FillRect(420,Y1,60,212); + lcd.SetBackColor(LCD_COLOR_BROWN); + lcd.SetTextColor(LCD_COLOR_LIGHTYELLOW); + lcd.DisplayStringAt(0, LINE(3), (uint8_t *)"B ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"A ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"C ",RIGHT_MODE); + lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"K ",RIGHT_MODE); + + + c=1; + midi.write(MIDIMessage::NoteOn(102)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(102)); + + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 440&&TS_State.touchX[0]<480&&TS_State.touchY[0] >= 0&&TS_State.touchY[0] < 60) + { + o=o+1; + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 320&&TS_State.touchX[0]<360&&TS_State.touchY[0] >= 0&&TS_State.touchY[0] < 60) + { + o=o-1; + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("0"); + midi.write(MIDIMessage::NoteOn(60+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(60+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("k"); + midi.write(MIDIMessage::NoteOn(61+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(61+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("d"); + midi.write(MIDIMessage::NoteOn(62+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(62+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= 60&&TS_State.touchY[0] < 130.667) + { + pc.printf("n"); + midi.write(MIDIMessage::NoteOn(63+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(63+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("z"); + midi.write(MIDIMessage::NoteOn(64+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(64+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("x"); + midi.write(MIDIMessage::NoteOn(65+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(65+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("y"); + midi.write(MIDIMessage::NoteOn(66+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(66+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >= 130.667 &&TS_State.touchY[0]<201.34) + { + pc.printf("s"); + midi.write(MIDIMessage::NoteOn(67+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(67+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 0&&TS_State.touchX[0]<105&&TS_State.touchY[0] >=201.34) + { + pc.printf("U"); + midi.write(MIDIMessage::NoteOn(68+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(68+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 105&&TS_State.touchX[0]<210&&TS_State.touchY[0] >=201.34) + { + pc.printf("N0"); + midi.write(MIDIMessage::NoteOn(69+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(69+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 210&&TS_State.touchX[0]<315&&TS_State.touchY[0] >=201.34) + { + pc.printf("N1"); + midi.write(MIDIMessage::NoteOn(70+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(70+(k*o))); + } + else if(a==0&&b==0&&c==1&&TS_State.touchX[0] >= 315&&TS_State.touchX[0]<420&&TS_State.touchY[0] >=201.34) + { + pc.printf("N2"); + midi.write(MIDIMessage::NoteOn(71+(k*o))); + wait_ms(150); + midi.write(MIDIMessage::NoteOff(71+(k*o))); + } + + + else if(TS_State.touchX[0] >= 420&&TS_State.touchY[0] >=60&&a==0&&b==0&&c==1) + { + c = 0; + pc.printf("bye3"); + + midi.write(MIDIMessage::NoteOn(101)); + wait_ms(50); + midi.write(MIDIMessage::NoteOff(101)); + + goto top; + } + + } + a0=v.read()*127; + midi.write(MIDIMessage::ControlChange(1,a0)); + + + + + wait_ms(50); + + } +} \ No newline at end of file
diff -r 000000000000 -r 33a7ad2adf6c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 14 15:59:23 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file