This code displays a Tic Tac Toe on your TFT screen. This game can be played using the tactility of your screen.
The first screen displays the title and some explanations about the game. The second screen is the "playing board" : it's here that you can place your pads.
There are two type of pads : red and blue pads (because this game can be played only with two people). If someone win, a message will be display ("Victory, Player 1/2 win !") and the game starts again. If nobody win, another message will be displayed, saying : "No winner.".
CodeFor making this code, I use some functions (in particular for tactility) from an exemple code in Elegoo_TFTLCD library.
Library, variables and colors are defined.
XP, XM, YP and YM are used for initializing tactility and a, ab, b, bb,..., I and ib are used for defining if a blue or a red pad has been placed.
By using these variables, we will be able to say if 3 blue/red pads have been aligned, and to say if someone (blue or red player) win the game.
The first letter means where the pad is placed (a = 1st case, b = 2nd case,...) and the second letter means if the pad is blue or not (no 2nd letter : the blue pad has been placed / 2nd letter = b : the red pad has been placed).
x is used to define if a player has played or not, i.e. if x==0 blue will play, but if x==1 red will play. We firstly say x==0, so blue starts to play. Once blue has played, x is incremented and red will be able to play next turn.
rturn is used to display grid once the first turn has been played.
#include <TouchScreen.h>
#include <Elegoo_GFX.h>
#include <Elegoo_TFTLCD.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define YP A2
#define XM A3
#define YM 8
#define XP 9
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 400);
Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
//x = 0 :blue
//x = 1 :red
int x = 0;
int rturn = 0;
int a;
int ab;
int b;
int bb;
int c;
int cb;
int d;
int db;
int e;
int eb;
int f;
int fb;
int g;
int gb;
int h;
int hb;
int i;
int ib;
On setup loop, we define what are properties of the screen (rotation, color of the screen, etc...) and we start to make our first display on the screen : the title of our game ("Tic Tac Toe"), the creator and some explanations about the game.
Then, we draw the playing "board" (the grid).
tft.reset();
tft.begin(0x9341);
tft.fillScreen(BLACK);
tft.setRotation(1);
Serial.begin(9600);
tft.setCursor(60, 110);
tft.setTextColor(RED);
tft.setTextSize(3);
tft.println("Tic Tac Toe");
delay(2000);
tft.setCursor(113, 154);
tft.setTextColor(CYAN);
tft.setTextSize(1);
tft.println("by MisterBotBreak");
delay(2000);
tft.setCursor(5, 178);
tft.setTextColor(GREEN);
tft.setTextSize(1);
tft.println("In this game, there are two players : Player BLUE");
tft.setCursor(5, 187);
tft.println("and Player RED. Each turn, they can put pads on a");
tft.setCursor(5, 196);
tft.println("grid. You win once three of your pads are aligned.");
delay(9000);
tft.fillScreen(BLACK);
tft.drawLine(113, 10, 113, 230, WHITE);
tft.drawLine(208, 10, 208, 230, WHITE);
tft.drawLine(30, 80, 290, 80, WHITE);
tft.drawLine(30, 160, 290, 160, WHITE);
pinMode(13, OUTPUT);
Here it is ! The first part of "void loop" is reserved for game restart once she's finished.
Then we will start to collect information about tactility of the screen (using TSPoint p = ts.getPoint(); function).
Actually, for each cases of the grid, a area is defined using p.x / p.y variables (that are collected thanks to TSPoint p). If a point (on the screen) is pressed and matchs with a case of the grid, the code will display a red or a blue pad (color depends on x value).
Then, one of the previous variables (about color and position of the pad) will be incremented to 1, so we'll know position and color of the pad. As said before, it will help us to determine if someone wins, and who.
returning:
if(rturn==1){
tft.fillScreen(BLACK);
tft.drawLine(113, 10, 113, 230, WHITE);
tft.drawLine(208, 10, 208, 230, WHITE);
tft.drawLine(30, 80, 290, 80, WHITE);
tft.drawLine(30, 160, 290, 160, WHITE);
rturn = 0;
x = 0;
a = 0;
ab = 0;
b = 0;
bb = 0;
c = 0;
cb = 0;
d = 0;
db = 0;
e = 0;
eb = 0;
f = 0;
fb = 0;
g = 0;
gb = 0;
h = 0;
hb = 0;
i = 0;
ib = 0;
}
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);
if (p.z > ts.pressureThreshhold) {
/*Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);*/
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
if(p.y < 380){
if(p.x < 400){
if(x==0){
tft.fillCircle(70, 45, 25, BLUE);
x=x+1;
a = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(70, 45, 25, RED);
x=x-1;
ab = 1;
delay(10);
}
}
else if(p.x < 650 && p.x > 400){
if(x==0){
tft.fillCircle(160, 45, 25, BLUE);
x=x+1;
b = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(160, 45, 25, RED);
x=x-1;
bb = 1;
delay(10);
}
}
else if(p.x > 650){
if(x==0){
tft.fillCircle(250, 45, 25, BLUE);
x=x+1;
c = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(250, 45, 25, RED);
x=x-1;
cb = 1;
delay(10);
}
}
}
//------------------------------------------------------------------------------------------------------------
else if(p.y > 380 && p.y < 650){
if(p.x < 400){
if(x==0){
tft.fillCircle(70, 120, 25, BLUE);
x=x+1;
d = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(70, 120, 25, RED);
x=x-1;
db = 1;
delay(10);
}
}
else if(p.x < 650 && p.x > 400){
if(x==0){
tft.fillCircle(160, 120, 25, BLUE);
x=x+1;
e = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(160, 120, 25, RED);
x=x-1;
eb = 1;
delay(10);
}
}
else if(p.x > 650){
if(x==0){
tft.fillCircle(250, 120, 25, BLUE);
x=x+1;
f = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(250, 120, 25, RED);
x=x-1;
fb = 1;
delay(10);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
else if(p.y > 650){
if(p.x < 400){
if(x==0){
tft.fillCircle(70, 195, 25, BLUE);
x=x+1;
g = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(70, 195, 25, RED);
x=x-1;
gb = 1;
delay(10);
}
}
else if(p.x < 650 && p.x > 400){
if(x==0){
tft.fillCircle(160, 195, 25, BLUE);
x=x+1;
h = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(160, 195, 25, RED);
x=x-1;
hb = 1;
delay(10);
}
}
else if(p.x > 650){
if(x==0){
tft.fillCircle(250, 195, 25, BLUE);
x=x+1;
i = 1;
delay(10);
}
else if(x==1){
tft.fillCircle(250, 195, 25, RED);
x=x-1;
ib = 1;
delay(10);
}
}
}
delay(500);
Even if this part seems long, she is pretty easy to understand.
Basically, we define all possible positions of blue/red pads to win.If these positions are aligned (for a same color), then we display a victory message (for the corresponding color) and we start over the game.
There are 8 possibility for each color, so 16 possibility for both colors.
If this part of the code is long, it's because I prefered to copy/past victory message than making a function (paradoxically, it was a little more easier for me to copy/paste the message), however you can still create a function if you want to ^^.
if(a==1 && b==1 && c==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(d==1 && e==1 && f==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(g==1 && h==1 && i==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
//======================================================
if(a==1 && d==1 && g==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(b==1 && e==1 && h==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(c==1 && f==1 && i==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
//================================================
if(c==1 && e==1 && g==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(a==1 && e==1 && i==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(GREEN);
tft.setTextSize(2);
tft.println("Player 1 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
//----------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------- FOR RED WINNING
if(ab==1 && bb==1 && cb==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(db==1 && eb==1 && fb==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(gb==1 && hb==1 && ib==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
//=====================================================================
if(ab==1 && db==1 && gb==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(bb==1 && eb==1 && hb==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(cb==1 && fb==1 && ib==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
//========================================================================
if(cb==1 && eb==1 && gb==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
if(ab==1 && eb==1 && ib==1){
tft.fillScreen(BLACK);
tft.setCursor(80, 110);
tft.setTextColor(YELLOW);
tft.setTextSize(3);
tft.println("Victory !");
tft.setCursor(72, 140);
tft.setTextColor(RED);
tft.setTextSize(2);
tft.println("Player 2 Win !");
delay(3000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
This last part of the code display a "No winner." message if all cases are used and if nobody aligned pads. Then the game restarts.
if(a||ab==1){
if(b||bb==1){
if(c||cb==1){
if(d||db==1){
if(e||eb==1){
if(f||fb==1){
if(g||gb==1){
if(h||hb==1){
if(i||ib==1){
tft.fillScreen(BLACK);
tft.setCursor(65, 100);
tft.setTextColor(GREEN);
tft.setTextSize(3);
tft.println("No winner.");
delay(2000);
tft.fillScreen(BLACK);
tft.setCursor(20, 110);
tft.setTextColor(CYAN);
tft.setTextSize(2);
tft.println("Ready for another game ?");
delay(2000);
tft.setCursor(100, 140);
tft.setTextColor(MAGENTA);
tft.setTextSize(2);
tft.println("Loading");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading.");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading..");
delay(800);
tft.setCursor(100, 140);
tft.println("Loading...");
delay(800);
rturn = 1;
goto returning;
}
}
}
}
}
}
}
}
}
Some photos of screensThere aren't special connections, you only need to plug the touchscreen on the arduino.
LibraryHere is a link to the TouchScreen.h library : https://github.com/adafruit/Adafruit_TouchScreen/blob/master/TouchScreen.h
Others libraries (such as GFX and TFTLCD) are available in "Enclosures" part. You can also find them into my previous projects.
Comments