Okay sorry Tom i didn't read all but now I hope it will be better.
So here is the code (sorry it's written in french) and the pic of my circuit will be below.
and while i was writing those lines, the warnings disappeared but when i touch the screen nothing happened
////////////////////////////////////////////////////////////////////////////////
////////// /!\ Mettre ici le nom des cockatils /!\ //////////
////////////////////////////////////////////////////////////////////////////////
// Pour nommer votre cocktail il suffit de marquer son nom entre les guillemets
char COCKTAIL_1[] = "Ricard";
char COCKTAIL_2[] = "Whisky";
char COCKTAIL_3[] = "Whisky-Coca";
char COCKTAIL_4[] = "Mazout";
///////////////////////////////////////////////////////////////////////////////////
////////// /!\ Mettre ici les doses des cockatils /!\ //////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>
#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif
#define YP A3 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 9 // can be a digital pin
#define XP 8 // can be a digital pin
#define TS_MINX 155
#define TS_MINY 120
#define TS_MAXX 855
#define TS_MAXY 900
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we re using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4
// Assign human-readable names to some common 16-bit color values:
#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 MINPRESSURE 10
#define MAXPRESSURE 1000
#define BOXSIZE 40
int currentpage = 0; // variable de sélection de page
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
////////////////////////////////////////////////////////////////////////////////
// Fonctions
////////////////////////////////////////////////////////////////////////////////
/* CONTROLE MENU */
boolean next(TSPoint p) //Appuyer sur le bouton suivant
{
if ((p.x < 320) && (p.x > 280) && (p.y < 140) && (p.y > 100))
{
return true;
}
return false;
}
boolean prev(TSPoint p) //Appuyer sur le bouton précédent
{
if ((p.x < 40) && (p.x > 0) && (p.y < 140) && (p.y > 100))
{
return true;
}
return false;
}
boolean valider(TSPoint p)
{
if ((p.x < 202) && (p.x > 114) && (p.y < 232) && (p.y > 212))
{
return true;
}
return false;
}
/* DESIGN */
int position_titre(char cocktail[])
{
int sizecocktail = strlen(cocktail);
int x0 = 159 - (sizecocktail * 20 / 2);
return (x0);
}
void nom_cocktail(char cocktail[])
{
int x = position_titre(cocktail) ;
tft.setCursor(x, 2);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.print(cocktail);
}
void nom_cocktail_wate(char cocktail[])
{
int x = position_titre(cocktail) ;
tft.setCursor(x, 94);
tft.setTextColor(RED);
tft.setTextSize(3);
tft.print(cocktail);
}
void ecran0()
{
tft.fillScreen(WHITE);
tft.drawTriangle(280, 140, 280, 100, 320, 120, BLACK);
tft.drawTriangle(40, 140, 40, 100, 0, 120, BLACK);
// Numéro de la page
tft.setCursor(307, 223);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("0");
// Nom du cocktail
nom_cocktail(COCKTAIL_1);
// Bouton valider
tft.fillRect(114, 212, 88, 20, RED);
tft.drawRect(114, 212, 88, 20, BLACK);
tft.setCursor(117, 215);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("VALIDER");
}
void ecran1()
{
tft.fillScreen(WHITE);
tft.drawTriangle(280, 140, 280, 100, 320, 120, BLACK);
tft.drawTriangle(40, 140, 40, 100, 0, 120, BLACK);
// Numéro de la page
tft.setCursor(307, 223);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("1");
// Nom du cocktail
nom_cocktail(COCKTAIL_2);
// Bouton valider
tft.fillRect(114, 212, 88, 20, RED);
tft.drawRect(114, 212, 88, 20, BLACK);
tft.setCursor(117, 215);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("VALIDER");
}
void ecran2()
{
tft.fillScreen(WHITE);
tft.drawTriangle(280, 140, 280, 100, 320, 120, BLACK);
tft.drawTriangle(40, 140, 40, 100, 0, 120, BLACK);
// Numéro de la page
tft.setCursor(307, 223);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("2");
// Nom du cocktail
nom_cocktail(COCKTAIL_3);
// Bouton valider
tft.fillRect(114, 212, 88, 20, RED);
tft.drawRect(114, 212, 88, 20, BLACK);
tft.setCursor(117, 215);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("VALIDER");
}
void ecran3()
{
tft.fillScreen(WHITE);
tft.drawTriangle(280, 140, 280, 100, 320, 120, BLACK);
tft.drawTriangle(40, 140, 40, 100, 0, 120, BLACK);
// Numéro de la page
tft.setCursor(307, 223);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("3");
// Nom du cocktail
nom_cocktail(COCKTAIL_4);
// Bouton valider
tft.fillRect(114, 212, 88, 20, RED);
tft.drawRect(114, 212, 88, 20, BLACK);
tft.setCursor(117, 215);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println("VALIDER");
}
void ecran_attente(char cocktail[])
{
tft.fillScreen(WHITE);
tft.setCursor(109, 69);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.println("Votre");
nom_cocktail_wate(cocktail);
tft.setCursor(49, 119);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.println("est en cours");
tft.setCursor(29, 144);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.println("de preparation");
}
////////////////////////////////////////////////////////////////////////////////
// Setup
////////////////////////////////////////////////////////////////////////////////
void setup(void)
{
Serial.begin(9600);
tft.reset();
uint16_t identifier = tft.readID();
if(identifier == 0x9325) {
Serial.println(F("Found ILI9325 LCD driver"));
} else if(identifier == 0x9328) {
Serial.println(F("Found ILI9328 LCD driver"));
} else if(identifier == 0x7575) {
Serial.println(F("Found HX8347G LCD driver"));
} else if(identifier == 0x9341) {
Serial.println(F("Found ILI9341 LCD driver"));
} else if(identifier == 0x8357) {
Serial.println(F("Found HX8357D LCD driver"));
} else {
Serial.print(F("Unknown LCD driver chip: "));
Serial.println(identifier, HEX);
Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT"));
Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
Serial.println(F("If using the breakout board, it should NOT be #defined!"));
Serial.println(F("Also if using the breakout, double-check that all wiring"));
Serial.println(F("matches the tutorial."));
return;
}
tft.begin(identifier);
tft.setRotation(1);
tft.fillScreen(WHITE);
tft.setCursor(50, 95);
tft.setTextColor(RED);
tft.setTextSize(5);
tft.println("WELCOME");
delay(3000);
pinMode(13, OUTPUT);
ecran0();
}
////////////////////////////////////////////////////////////////////////////////
// loop principale
////////////////////////////////////////////////////////////////////////////////
void loop()
{
tft.setRotation(1); // ecran en paysage
digitalWrite(13, HIGH); // acquisition de la pression sur l écran
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);
delay(100);
// if sharing pins, you ll need to fix the directions of the touchscreen pins
//pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
//pinMode(YM, OUTPUT);
if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
{
// mapping de l ecran afin d attribuer des coordonées à l'endroit où l on appuie
int16_t nTmpX = p.x;
p.x = 320 - map(p.y, TS_MINY, TS_MAXY, 0, 320);
p.y = map(nTmpX, TS_MINX, TS_MAXX, 0, 240);
delay(100);
switch (currentpage)
{
case 0 :
if (valider(p) == true)
{
ecran_attente(COCKTAIL_1);
delay(3000);
ecran0();
}
else if (next(p)==true)
{
currentpage = 1;
ecran1();
}
else if (prev(p)==true)
{
currentpage = 3;
ecran3();
}
else break;
case 1 :
if (valider(p) == true)
{
ecran_attente(COCKTAIL_2);
delay(3000);
ecran1();
}
if (next(p)==true)
{
currentpage = 2;
ecran2();
}
else if (prev(p)==true)
{
currentpage = 0;
ecran0();
}
else break;
case 2 :
if (valider(p) == true)
{
ecran_attente(COCKTAIL_3);
delay(3000);
ecran2();
}
if (next(p)==true)
{
currentpage = 3;
ecran3();
}
else if (prev(p)==true)
{
currentpage = 1;
ecran1();
}
else break;
case 3 :
if (valider(p) == true)
{
ecran_attente(COCKTAIL_4);
delay(3000);
ecran3();
}
if (next(p)==true)
{
currentpage = 0;
ecran0();
}
else if (prev(p)==true)
{
currentpage = 2;
ecran2();
}
else break;
}
}
}