Problem with TFTLCD 2.8 and arduino mega

I made a program for a touchscreen 2.8 ILI9341 with arduino uno and it worked as expected.
I decided to change my Uno for a mega. In the Adafruit_TFTLCD library, it's said that pin aren't the same as the Uno so i changed them.
Screen_Pinout

But when i run the program, it's send to the screen, the screen is detected, but when i touch the screen, nothing happens and i got those warnings :

C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:933:0: warning: "read8" redefined
 #define read8(x) x = read8fn()
 
In file included from C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:17:0:
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:230:0: note: this is the location of the previous definition
 #define read8 read8inline
 
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::begin(uint16_t)':
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:533:12: warning: large integer implicitly truncated to unsigned type [-Woverflow]
     lo = (d);                                                                  \
            ^
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:234:25: note: in expansion of macro 'writeRegister16inline'
 #define writeRegister16 writeRegister16inline
                         ^~~~~~~~~~~~~~~~~~~~~
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:352:5: note: in expansion of macro 'writeRegister16'
     writeRegister16(ILI9341_VCOMCONTROL1, 0x2B2B);
     ^~~~~~~~~~~~~~~

I think it's due to library but I don't know what to change.
The program I use is not it the following one but i got exactly the same problem with it, and i know it works. It's the tftpaint from arduino_TFTLCD library example.

if anyone got an answer to my problem it will be great

Hi, @justin_de_timetjustin
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
https://forum.arduino.cc/index.php?topic=712198.0
Then look down to "code problems" about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

1 Like

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;
    }
  }
}
  

I copied your code to a new sketch and it compiled without any of the warnings you saw (did not try the code as I don't have your setup...)

Can you turn on verbose compiler warnings (File -> Preferences -> Show verbose warnings during: <check beside compilation> ) recompile and copy the full contents of the message window here in code tags for examination.

I'm tempted to suggest you go into your library folder and delete the Adafruit_TFTLCD library and then re-install it using the Library Manager but the full compiler messages might should be able to better inform a path forward.

1 Like

I deleted the TFTLCD library as you said and re-install it but still have the same problem

here are the warnings with the full content of the message window you asked for :

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\Justin\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\Justin\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Justin\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=2341_0042 -ide-version=10813 -build-path C:\Users\Justin\AppData\Local\Temp\arduino_build_463184 -warnings=none -build-cache C:\Users\Justin\AppData\Local\Temp\arduino_cache_54370 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\Justin\Desktop\Machine Cocktail\touchscreen2_8Arduino\touchscreen2_8Arduino.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\Justin\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\Justin\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Justin\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=2341_0042 -ide-version=10813 -build-path C:\Users\Justin\AppData\Local\Temp\arduino_build_463184 -warnings=none -build-cache C:\Users\Justin\AppData\Local\Temp\arduino_cache_54370 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\Justin\Desktop\Machine Cocktail\touchscreen2_8Arduino\touchscreen2_8Arduino.ino
Using board 'mega' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Adafruit_GFX.h: [Adafruit_GFX_Library@1.5.3 Adafruit_GFX_Library-1.3.6@1.3.6]
ResolveLibrary(Adafruit_GFX.h)
  -> candidates: [Adafruit_GFX_Library@1.5.3 Adafruit_GFX_Library-1.3.6@1.3.6]
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Adafruit_TFTLCD.h: [Adafruit_TFTLCD_Library@1.0.3]
ResolveLibrary(Adafruit_TFTLCD.h)
  -> candidates: [Adafruit_TFTLCD_Library@1.0.3]
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TFTLCD_Library" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for TouchScreen.h: [Adafruit_TouchScreen@1.1.1]
ResolveLibrary(TouchScreen.h)
  -> candidates: [Adafruit_TouchScreen@1.1.1]
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TFTLCD_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TouchScreen" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Using cached library dependencies for file: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_GFX.cpp
Using cached library dependencies for file: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_SPITFT.cpp
Alternatives for SPI.h: [SPI@1.0 SPI-master@1.0]
ResolveLibrary(SPI.h)
  -> candidates: [SPI@1.0 SPI-master@1.0]
Using cached library dependencies for file: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library\glcdfont.c
Using cached library dependencies for file: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp
Using cached library dependencies for file: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TouchScreen\TouchScreen.cpp
Using cached library dependencies for file: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SPI\src\SPI.cpp
Generating function prototypes...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TFTLCD_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TouchScreen" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SPI\\src" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compilation du croquis...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\mega" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TFTLCD_Library" "-IC:\\Users\\Justin\\Documents\\Arduino\\libraries\\Adafruit_TouchScreen" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\SPI\\src" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp" -o "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp.o"
Compiling libraries...
Compiling library "Adafruit_GFX_Library"
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\Adafruit_GFX_Library\glcdfont.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\Adafruit_GFX_Library\Adafruit_GFX.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\Adafruit_GFX_Library\Adafruit_SPITFT.cpp.o
Compiling library "Adafruit_TFTLCD_Library"
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp.o
Compiling library "Adafruit_TouchScreen"
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\Adafruit_TouchScreen\TouchScreen.cpp.o
Compiling library "SPI"
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\libraries\SPI\SPI.cpp.o
Compiling core...
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring_pulse.S.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\hooks.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring_analog.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\WInterrupts.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring_digital.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring_pulse.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\wiring_shift.c.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\CDC.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\HardwareSerial0.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\HardwareSerial1.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\HardwareSerial2.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\HardwareSerial3.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\IPAddress.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\HardwareSerial.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\PluggableUSB.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\Tone.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\USBCore.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\WMath.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\WString.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\abi.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\Stream.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\Print.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\new.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\main.cpp.o
Utilisation du fichier déjà compilé : C:\Users\Justin\AppData\Local\Temp\arduino_build_463184\core\core.a
Archivage du noyau construit (mise en cache) dans :  C:\Users\Justin\AppData\Local\Temp\arduino_cache_54370\core\core_arduino_avr_mega_cpu_atmega2560_d72cf7820821928d7aba3a85f82dacbf.a
Linking everything together...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.elf" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\sketch\\touchscreen2_8Arduino.ino.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\Adafruit_GFX_Library\\glcdfont.c.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\Adafruit_GFX_Library\\Adafruit_GFX.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\Adafruit_GFX_Library\\Adafruit_SPITFT.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\Adafruit_TFTLCD_Library\\Adafruit_TFTLCD.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\Adafruit_TouchScreen\\TouchScreen.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184\\libraries\\SPI\\SPI.cpp.o" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/core\\core.a" "-LC:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184" -lm
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.elf" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.eep"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.elf" "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.hex"
Plusieurs bibliothèque trouvées pour "Adafruit_GFX.h"
Utilisé : C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library
Non utilisé : C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library-1.3.6
Plusieurs bibliothèque trouvées pour "SPI.h"
Utilisé : C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SPI
Non utilisé : C:\Users\Justin\Documents\Arduino\libraries\SPI-master
Utilisation de la bibliothèque Adafruit_GFX_Library version 1.5.3 dans le dossier: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_GFX_Library 
Utilisation de la bibliothèque Adafruit_TFTLCD_Library version 1.0.3 dans le dossier: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library 
Utilisation de la bibliothèque Adafruit_TouchScreen version 1.1.1 dans le dossier: C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TouchScreen 
Utilisation de la bibliothèque SPI version 1.0 dans le dossier: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SPI 
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\Justin\\AppData\\Local\\Temp\\arduino_build_463184/touchscreen2_8Arduino.ino.elf"
Le croquis utilise 21822 octets (8%) de l'espace de stockage de programmes. Le maximum est de 253952 octets.
Les variables globales utilisent 414 octets (5%) de mémoire dynamique, ce qui laisse 7778 octets pour les variables locales. Le maximum est de 8192 octets.

It doesn't look like the "same" problem. For example, in your OP a warning:

C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:933:0: warning: "read8" redefined
 #define read8(x) x = read8fn()
 
In file included from C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:17:0:
C:\Users\Justin\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:230:0: note: this is the location of the previous definition
 #define read8 read8inline

is not repeated in the latest list of warnings.

The other thing is that it appears that the code successfully compiled; Warnings are not always a sign of failure per se. In fact, in your latest list I don't actually see any warnings at all.

What's the problem?

The problem is that my full code works perfectly on arduino uno, the touchscreen does what I want. but when I decided to use an arduino mega instead of the Uno, the screen is detected by the card as it should be, but warning from the library appears and when I touch the screen nothing happens.

For the wiring I did exactly what's written here for Arduino Mega :

Okay I found my mistake !

At the beginning of my program, I didn't change the pin number :

#define YP A3  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 23   // can be a digital pin
#define XP 22   // can be a digital pin

I'm sorry it was a so stupid mistake ^^
thank you very much for the time you spent solving my problem !

EDIT: See you have a solution. Ignore what follows...

Can you post your full code? Or at least a minimally-viable example that shows the problem (both library warning and the touchscreen problem)?

I'm a little confused by the touchscreen connection. How was this connected to the Uno? Which do you have:

or

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.