Library to calculate movement and to draw the objects in the pong game
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed
Fork of MainSketch by
Diff: main.cpp
- Revision:
- 4:14043cafbec7
- Parent:
- 3:676adf84c914
- Child:
- 5:424af4fa03ab
--- a/main.cpp Thu Jun 11 09:23:37 2015 +0000 +++ b/main.cpp Thu Jun 09 10:33:48 2016 +0000 @@ -1,7 +1,4 @@ -// example to test the TFT Display from banggood.com -// Thanks to the GraphicsDisplay and TextDisplay classes -// test.bmp has to be on the mbed file system -// and on the sd-card +// example to test the TFT Display from Mikroelectronika #include "stdio.h" #include "mbed.h" @@ -11,10 +8,9 @@ #include "Arial24x23.h" #include "Arial28x28.h" #include "font_big.h" -#include "SDFileSystem.h" + -// the SD-connector is connected to SPI pin 11-13 -//SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs + @@ -29,7 +25,7 @@ //NB better combination to use a coherent 2x4 block for lcd // SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTA16, PTA17, PTC16,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z // DigitalOut LCD_LED(PTC17); -//SDFileSystem sd(PTD2, PTD3, PTD1, PTA1, "sd"); // mosi,miso,sck,cs + int main() { pwr=1; @@ -96,86 +92,7 @@ TFT.printf("1.21 1.21 1.21"); wait(10); - /* - wait(5); - - // draw some graphics - TFT.cls(); - TFT.set_font((unsigned char*) Arial24x23); - TFT.locate(100,100); - TFT.printf("Graphic"); - - TFT.line(0,0,100,0,Green); - TFT.line(0,0,0,200,Green); - TFT.line(0,0,100,200,Green); - - TFT.rect(100,50,150,100,Red); - TFT.fillrect(180,25,220,70,Blue); - - TFT.circle(80,150,33,White); - TFT.fillcircle(160,190,20,Yellow); - - double s; - - for (i=0; i<320; i++) { - s =20 * sin((long double) i / 10 ); - TFT.pixel(i,100 + (int)s ,Red); - } - - - wait(5); // wait two seconds - - // bigger text - TFT.foreground(White); - TFT.background(Blue); - TFT.cls(); - TFT.set_font((unsigned char*) Arial24x23); - TFT.locate(0,0); - TFT.printf("Different Fonts :"); - - TFT.set_font((unsigned char*) Neu42x35); - TFT.locate(10,30); - TFT.printf("Hello Mbed 1"); - TFT.set_font((unsigned char*) Arial24x23); - TFT.locate(20,80); - TFT.printf("Hello Mbed 2"); - TFT.set_font((unsigned char*) Arial12x12); - TFT.locate(35,120); - TFT.printf("Hello Mbed 3"); - wait(5); - - TFT.background(Black); - TFT.cls(); - TFT.locate(10,10); - TFT.printf("Graphic from Flash"); - - // mbed logo - // defined in graphics.c - //__align(4) - //unsigned char p1[18920] = { - //0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, .... - // - TFT.Bitmap(90,90,172,55,p1); - - wait(5); - TFT.cls(); - - // to compare the speed of the internal file system and a SD-card - TFT.locate(10,10); - TFT.printf("Graphic from internal File System"); - TFT.locate(20,20); - TFT.printf("open test.bmp"); - int err = TFT.BMP_16(50,50,"/local/test.bmp"); - if (err != 1) TFT.printf(" - Err: %d",err); - wait(5); - for(i=0;i<10;i++){ - LCD_LED = 1; - wait(0.2); - LCD_LED = 0; - wait(0.2); - } - - */ + } }