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
main.cpp
- Committer:
- MetropoliaMies
- Date:
- 2014-02-06
- Revision:
- 4:76c054f8b97e
- Parent:
- 3:c8a476a218e3
- Child:
- 5:8e13103b41be
File content as of revision 4:76c054f8b97e:
#include "mbed.h" #include "Arial12x12.h" #include "Arial28x28.h" #include "USBMIDI.h" #include "light_pressed.h" // the TFT is connected to SPI pin 5-7 // the touch is connected to 19,20,16,17 Serial pc(USBTX, USBRX); void draw_buttons(unsigned short color) { unsigned int i = 0; for (i = 0; i<10; i++) { //draw buttons buttons(i, color); tft.locate(10,50); printf("Shift"); } } int main() { // PERUSPOHJA, ÄLÄ MUOKKAA! point p; unsigned short color = White; unsigned short color2 = Blue; tft.claim(stdout); // send stdout to the TFT display tft.background(Black); // set background to black tft.foreground(White); // set chars to white tft.cls(); // clear the screen tft.set_font((unsigned char*) Arial12x12); // select the font tft.set_orientation(0); tft.calibrate(); tft.locate(180,0); //show coordinates printf(" x = "); tft.locate(180,12); printf(" y = "); tft.locate(85,0); printf(" Octave = "); tft.locate(85, 12); printf(" Slider = "); tft.locate(0,0); printf(" MIDIMAN! "); tft.line(0,83,239,83,White); while (1) { color = White; draw_buttons(color); while (tft.is_touched(tft.get_touch())) { // touch p = tft.get_touch(); p = tft.to_pixel(p); // convert to pixel position if (shift == 1) { light_pressed2(color2, p); } else { light_pressed(color, p); } tft.locate(210,0); printf("%3d",p.x); tft.locate(210,12); printf("%3d",p.y); tft.locate(160, 0); // printf("%3d", octave); tft.locate(160, 12); printf("%i", slider); } } }