Ejemplo con TFT ili9341

Dependencies:   mbed SPI_TFT_ILI9341 LCD_fonts UTouch

Files at this revision

API Documentation at this revision

Comitter:
Diego_Mbed
Date:
Tue May 05 03:31:14 2020 +0000
Commit message:
Hola gente;

Changed in this revision

LCD_fonts.lib Show annotated file Show diff for this revision Revisions of this file
SPI_TFT_ILI9341.lib Show annotated file Show diff for this revision Revisions of this file
UTouch.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 96ca69863b24 LCD_fonts.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_fonts.lib	Tue May 05 03:31:14 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dreschpe/code/LCD_fonts/#d0b7d7bf1f56
diff -r 000000000000 -r 96ca69863b24 SPI_TFT_ILI9341.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SPI_TFT_ILI9341.lib	Tue May 05 03:31:14 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/2018US_HarisSoljic/code/SPI_TFT_ILI9341/#b8956708b92f
diff -r 000000000000 -r 96ca69863b24 UTouch.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UTouch.lib	Tue May 05 03:31:14 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/rpocc/code/UTouch/#a275ef704eb8
diff -r 000000000000 -r 96ca69863b24 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 05 03:31:14 2020 +0000
@@ -0,0 +1,76 @@
+#include "mbed.h"
+#include "SPI_TFT_ILI9341.h"
+#include "string"
+#include "Arial12x12.h"
+#include "Arial24x23.h"
+#include "Arial_9.h"
+#include "Small_6.h"
+//#include "Arial28x28.h"
+//#include "font_big.h"
+#include "UTouch.h"
+#include "stdio.h"
+char buffer[10];
+extern unsigned char p1[]; // the mbed logo
+// the TFT is connected to SPI pin 5-7
+SPI_TFT_ILI9341 TFT(D11,D12,D13,D10,D9,D8,"TFT");
+UTouch  myTouch(A0, A1,D7, D5, D4);
+DigitalOut led(D14);
+int main(){
+    led=1;
+TFT.claim(stdout); // send stdout to the TFT display
+//TFT.claim(stderr); // send stderr to the TFT display
+TFT.set_orientation(1);
+TFT.background(Blue); // set background to black
+TFT.foreground(White); // set chars to white
+TFT.cls(); // clear the screen
+//first show the 4 directions
+TFT.set_orientation(0);
+TFT.cls();
+TFT.set_font((unsigned char*) Arial12x12);
+TFT.locate(0,10);
+printf(" BEE-LOCATOR 0");
+TFT.set_orientation(1);
+TFT.locate(0,10);
+printf(" BEE-LOCATOR 1");
+TFT.set_orientation(2);
+TFT.locate(0,10);
+printf(" BEE-LOCATOR 2");
+TFT.set_orientation(3);
+TFT.locate(0,10);
+printf(" BEE-LOCATOR 3");
+TFT.set_orientation(1);
+TFT.set_font((unsigned char*) Arial24x23);
+TFT.locate(75,50);
+TFT.printf("INFUSO");
+TFT.rect(90,190,210,100,Red);
+TFT.locate(110,135);
+TFT.printf("OFF");
+myTouch.InitTouch();
+myTouch.SetPrecision(PREC_LOW);
+float x=0,y=0;
+while(1){
+if (myTouch.DataAvailable())
+{
+if(myTouch.Read())
+{
+x = myTouch.GetX();
+y = myTouch.GetY();
+TFT.locate(30,50);
+sprintf (buffer, "%.0f , %.0f ", x, y);
+TFT.printf(buffer);
+TFT.rect(90,190,210,100,Red);
+if (y>100&&x>90&&y<190&&x<210){
+TFT.fillrect(90,190,210,100,Blue);
+TFT.rect(90,190,210,100,Red);
+TFT.locate(100,135);
+TFT.printf(" ON");
+}else
+TFT.rect(90,190,210,100,Blue);
+TFT.rect(90,190,210,100,Red);
+TFT.locate(120,135);
+TFT.printf("Off");
+
+}
+}
+}
+}
\ No newline at end of file
diff -r 000000000000 -r 96ca69863b24 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 05 03:31:14 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file