I'm trying to learn ESP32 with ili9431

I’m using Espressif ESP32-WROOM-32 along with ili9341 TFT display, IDE 2.3.7.

Compiling I have the following error: exit status 1

Compilation error: exit status 1

This is the sketch:

//#include <Adafruit_GFX.h>
//#include <Adafruit_ILI9341.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <WiFiManager.h>  // https://github.com/tzapu/WiFiManager


// Pin definitions
#define TFT_CS   5
#define TFT_DC   4
#define TFT_RST  2
#define TRIGGER_PIN 0

// Use hardware SPI
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
TFT_eSPI tft = TFT_eSPI();       // Invoke custom library
  int x=10;
  int y=20;

#define TFT_GREY 0x5AEB
int timeout = 120;  // seconds to run for




void setup() {
  Serial.begin(115200);
   WiFi.mode(WIFI_STA);  // explicitly set mode, esp defaults to STA+AP

  Serial.begin(115200);
  delay(2000);  // wait for Serial
  Serial.println("\n Starting");
  pinMode(TRIGGER_PIN, INPUT_PULLUP);

  Serial.println("starting Display ili8341 ");

  
  
  tft.begin();


  // Set display rotation (optional, 1 is landscape for some displays)
  tft.setRotation(2); 
  
  // Set background color
  tft.fillScreen(ILI9341_YELLOW);

  

  // Set text size
  tft.setTextSize(3); // Size 1 is 6x8 pixels, Size 2 is 12x16, etc.

  // Set text color
  tft.setTextColor(ILI9341_BLACK);
tft.print("Press the Connect button");
 // is configuration portal requested?

  if (digitalRead(TRIGGER_PIN) == LOW) {
    WiFiManager wm;

    //reset settings - for testing
    wm.resetSettings();
  
    // set configportal timeout
    wm.setConfigPortalTimeout(timeout);
  
    if (!wm.startConfigPortal("OnDemandAP")) {
      Serial.println("failed to connect and hit timeout");
      delay(3000);
      //reset and try again, or maybe put it to deep sleep
      ESP.restart();
      delay(5000);
    }
  }
      //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");

      // Set background color
  tft.fillScreen(ILI9341_RED);

  

  // Set text size
  tft.setTextSize(3); // Size 1 is 6x8 pixels, Size 2 is 12x16, etc.

  // Set text color
  tft.setTextColor(ILI9341_WHITE);
  tft.print("WIFI connected");
  delay(10000);

}

void loop() {
  for (int y=20; y <= 300; y=y+20){
  
  
    // Set cursor position (X, Y)
  tft.setCursor(x, y);
  
   // Print the message
  tft.print("Hello world");
 

  delay(1000);
  tft.fillScreen(ILI9341_YELLOW);
  //y=y+20;
  }
}

Can someone to guide to solve this error, please?

There's much more to the error message than that. Post the entire thing.

This is the message, no coloured error messages.

Using library ESP32 Async UDP at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\AsyncUDP
Using library Hash at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\Hash
exit status 1

Compilation error: exit status 1

If you don't post the entire verbose error log in code tags, nobody can help you.
BTW, Exit status 1 is not an error message, it's just the non-zero exit status. An error is a symbol not declared, and similar. We need to see which line number has the error.

In future first use the Tools menu Auto format and reduce blank lines to the minimum needed.

Compiling sketch...
"C:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-x32\\2511/bin/xtensa-esp32-elf-g++" -MMD -c "@C:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-9bb7aa84-v2\\esp32/flags/cpp_flags" -Wall -Wextra -Os -Werror=return-type -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_WROOM_DA -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_WROOM_DA\"" "-DARDUINO_VARIANT=\"esp32da\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"windows\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32da:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,LoopCore=1,EventsCore=1,EraseFlash=none\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DARDUINO_USB_CDC_ON_BOOT=0 "@C:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-9bb7aa84-v2\\esp32/flags/defines" "-IC:\\Users\\mikem\\Documents\\Arduino\\ESP32_WROOM_32_ILI9341" -iprefix "C:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-9bb7aa84-v2\\esp32/include/" "@C:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-9bb7aa84-v2\\esp32/flags/includes" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-9bb7aa84-v2\\esp32/qio_qspi/include" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\cores\\esp32" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\variants\\esp32da" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\SPI\\src" "-Ic:\\Users\\mikem\\Documents\\Arduino\\libraries\\TFT_eSPI" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\FS\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\SPIFFS\\src" "-Ic:\\Users\\mikem\\Documents\\Arduino\\libraries\\WiFiManager" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\WiFi\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\Network\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\Update\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\WebServer\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\DNSServer\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\AsyncUDP\\src" "-IC:\\Users\\mikem\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.5\\libraries\\Hash\\src" "@C:\\Users\\mikem\\AppData\\Local\\arduino\\sketches\\4D8B09605486584D16D22B2DAB0179FD/build_opt.h" "@C:\\Users\\mikem\\AppData\\Local\\arduino\\sketches\\4D8B09605486584D16D22B2DAB0179FD/file_opts" "C:\\Users\\mikem\\AppData\\Local\\arduino\\sketches\\4D8B09605486584D16D22B2DAB0179FD\\sketch\\ESP32_WROOM_32_ILI9341.ino.cpp" -o "C:\\Users\\mikem\\AppData\\Local\\arduino\\sketches\\4D8B09605486584D16D22B2DAB0179FD\\sketch\\ESP32_WROOM_32_ILI9341.ino.cpp.o"
In file included from C:\Users\mikem\Documents\Arduino\ESP32_WROOM_32_ILI9341\ESP32_WROOM_32_ILI9341.ino:4:
c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
  973 |       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
      |        ^~~~~~~
C:\Users\mikem\Documents\Arduino\ESP32_WROOM_32_ILI9341\ESP32_WROOM_32_ILI9341.ino:9:9: warning: "TFT_CS" redefined
    9 | #define TFT_CS   5
      |         ^~~~~~
In file included from c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/User_Setup_Select.h:27,
                 from c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:69:
c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/User_Setup.h:215:9: note: this is the location of the previous definition
  215 | #define TFT_CS   15  // Chip select control pin
      |         ^~~~~~
C:\Users\mikem\Documents\Arduino\ESP32_WROOM_32_ILI9341\ESP32_WROOM_32_ILI9341.ino:10:9: warning: "TFT_DC" redefined
   10 | #define TFT_DC   4
      |         ^~~~~~
c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/User_Setup.h:216:9: note: this is the location of the previous definition
  216 | #define TFT_DC    2  // Data Command control pin
      |         ^~~~~~
C:\Users\mikem\Documents\Arduino\ESP32_WROOM_32_ILI9341\ESP32_WROOM_32_ILI9341.ino:11:9: warning: "TFT_RST" redefined
   11 | #define TFT_RST  2
      |         ^~~~~~~
c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/User_Setup.h:217:9: note: this is the location of the previous definition
  217 | #define TFT_RST   4  // Reset pin (could connect to RST pin)
      |         ^~~~~~~
In file included from c:\Users\mikem\Documents\Arduino\libraries\WiFiManager/WiFiManager.h:94,
                 from C:\Users\mikem\Documents\Arduino\ESP32_WROOM_32_ILI9341\ESP32_WROOM_32_ILI9341.ino:5:
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:226:32: error: 'FS' was not declared in this scope; did you mean 'fs::FS'?
  226 |   typedef std::function<String(FS &fs, const String &fName)> ETagFunction;
      |                                ^~
      |                                fs::FS
In file included from c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/Processors/TFT_eSPI_ESP32.h:138,
                 from c:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:101:
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\FS\src/FS.h:87:7: note: 'fs::FS' declared here
   87 | class FS {
      |       ^~
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:226:32: error: 'FS' was not declared in this scope; did you mean 'fs::FS'?
  226 |   typedef std::function<String(FS &fs, const String &fName)> ETagFunction;
      |                                ^~
      |                                fs::FS
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\FS\src/FS.h:87:7: note: 'fs::FS' declared here
   87 | class FS {
      |       ^~
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:226:60: error: template argument 1 is invalid
  226 |   typedef std::function<String(FS &fs, const String &fName)> ETagFunction;
      |                                                            ^
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:226:16: error: '<expression error>' in namespace 'std' does not name a type
  226 |   typedef std::function<String(FS &fs, const String &fName)> ETagFunction;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:227:32: error: 'ETagFunction' has not been declared
  227 |   void enableETag(bool enable, ETagFunction fn = nullptr);
      |                                ^~~~~~~~~~~~
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:244:3: error: 'ETagFunction' does not name a type; did you mean 'TaskFunction_t'?
  244 |   ETagFunction _eTagFunction = nullptr;
      |   ^~~~~~~~~~~~
      |   TaskFunction_t
C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer\src/WebServer.h:227:50: error: could not convert 'nullptr' from 'std::nullptr_t' to 'int'
  227 |   void enableETag(bool enable, ETagFunction fn = nullptr);
      |                                                  ^~~~~~~
      |                                                  |
      |                                                  std::nullptr_t
Multiple libraries were found for "WiFi.h"
  Used: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WiFi
  Not used: C:\Users\mikem\Documents\Arduino\libraries\WiFi
Using library SPI at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\SPI 
Using library TFT_eSPI at version 2.5.43 in folder: C:\Users\mikem\Documents\Arduino\libraries\TFT_eSPI 
Using library FS at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\FS 
Using library SPIFFS at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\SPIFFS 
Using library WiFiManager at version 2.0.17 in folder: C:\Users\mikem\Documents\Arduino\libraries\WiFiManager 
Using library WiFi at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WiFi 
Using library Networking at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\Network 
Using library Update at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\Update 
Using library WebServer at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\WebServer 
Using library DNSServer at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\DNSServer 
Using library ESP32 Async UDP at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\AsyncUDP 
Using library Hash at version 3.3.5 in folder: C:\Users\mikem\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.5\libraries\Hash 
exit status 1

Compilation error: exit status 1
1 Like

Where did you get the code from. I can't compile it either and tere are some obvious mistakes.

Quite a different story than:

Compile errors pointing at a working library indicate syntax errors in the sketch.

I put together two sketches that I tried before independently, the Wifi on demand and the display part that follow, scroll the “Hello world”

These variables are not used. Indiscriminate mashup of various sketches.
Show the link to each individual sketch.
Also...

To properly use the TFT_eSPI library, you need a configuration file called User_Setup.h with the right definitions.

1 Like

@xfpd

void loop() {
  for (int y=20; y <= 300; y=y+20){
  
  
    // Set cursor position (X, Y)
  tft.setCursor(x, y);
  
   // Print the message
  tft.print("Hello world");
 

  delay(1000);
  tft.fillScreen(ILI9341_YELLOW);
  //y=y+20;
  }

Oh, I see.

Show the link to each sketch source.

Which tutorial have you used or which code sample have you used to get started (link)?
Your code contains references to the <TFT_eSPI.h> library but contains also relics of a similar Adafruit screen handling library.
Note that <TFT_eSPI.h> has compatibility problems with newer Esp32 Arduino cores .
I'd recommend using the Adafruit libraries unless you have a good reason to use an alternative.

1 Like

So , did the two sketches work on their own , no compile errors and screen working?

The code does compile without errors , not test on hardware.

Using board 'esp32' from platform in folder: C:\Users\mikee\AppData\Local\Arduino15\packages\esp32_2\hardware\esp32\2.0.11

Libraries used.(Screenshot).

1 Like

In the for loop a new variable named y is created... it shadows the other y.
Not wrong, but may be not the intention and may cause confusion.
Not recommended to have short variable names.
Do not allow yourself a lazy attitude (by not typing a few characters more) as it will cause a headache sooner or later...

1 Like

Both parts of the sketch are working independently. The reference to Adafruit is from the fact that I first tried it with OLED display.

You have pin definitions in ESP32_WROOM_32_ILI9341.ino and in \libraries\TFT_eSPI/User_Setup.h which conflict.
Maybe some left overs from your experiment with the Adafruit libraries.