MIDI Interface in progress
Dependencies: SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI
Diff: main.cpp
- Revision:
- 3:c8a476a218e3
- Parent:
- 2:478274cba6c3
- Child:
- 4:76c054f8b97e
--- a/main.cpp Mon Jan 20 11:20:51 2014 +0000 +++ b/main.cpp Thu Jan 30 06:30:10 2014 +0000 @@ -11,6 +11,13 @@ touch_tft tft(p20,p19,p18,p17,p5, p6, p7, p14, p15, p21, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset, dc +PwmOut led1(LED1); +PwmOut led2(LED2); +PwmOut led3(LED3); +PwmOut led4(LED4); +int q,w,e,r,s; + +float brightness = 0.0; void buttons(int b, unsigned short color) { //button field @@ -68,18 +75,22 @@ } if (p.x > 163 && p.x < 238) { //button 3 buttons(3, color); + brightness += 0.01; } } if (p.y > 163 && p.y < 238) { //ROW B if (p.x > 3 && p.x < 78) { //button 4 buttons(4, color); + s = 1; } if (p.x > 83 && p.x < 158) { //button 5 buttons(5, color); + led1 = 0.5; } if (p.x > 163 && p.x < 238) { //button 6 buttons(6, color); + s = 2; } } @@ -92,6 +103,7 @@ } if (p.x > 163 && p.x < 238) { //button 9 buttons(9, color); + brightness -= 0.01; } } } @@ -118,6 +130,19 @@ tft.locate(180,12); printf(" y = "); + tft.locate(90,0); // -------Kirkkaushömppää-------- + printf(" B = "); + + if (q = brightness && s = 1) { + q = 0; + w = brightness; + } + if (w = brightness && s = 1) { + w = 0; + e = brightness; + } + + tft.locate(0,0); printf(" MIDIMAN! "); tft.line(0,83,239,83,White); @@ -125,7 +150,11 @@ while (1) { color = White; - draw_buttons(color); + draw_buttons(color); + led1 = q; + led2 = w; + led3 = e; + led4 = r; while (tft.is_touched(tft.get_touch())) { // touch p = tft.get_touch(); @@ -133,10 +162,13 @@ light_pressed(Red,p); // light pressed button - tft.locate(216,0); + tft.locate(210,0); printf("%3d",p.x); - tft.locate(216,12); - printf("%3d",p.y); + tft.locate(210,12); + printf("%3d",p.y); + + tft.locate(100,0); + printf("%f", brightness); } }