ESP32 naar 3.5"TFT LCD Shield

Is het niet eenvoudiger een SPI schermpje te gebruiken. Ze kosten tenslotte geen rib meer. Met de Bodmer TFT_spi librarie is het dan eenvoudig aan te sturen.

Een ESP heeft nu eenmaal minder IO dan een Arduino. Ze zijn ook niet allemaal vrij te gebruiken. Sommige IO moeten hoog zijn bij het booten, andere laag.

Van Lambiek wordt goede geuze gemaakt.

De (micro)SD kaart ga ik niet gebruiken maar dit type scherm heb ik nu en zou ik dus graag gebruiken met mijn ESP.

dan heb je die 4 draden van Sd card niet nodig en kan je die gebruiken om het scherm aan te sturen.
moet je misschien wel een kleine aanpassing doen in het prgramma of de library om LCD-reset, LCD-CS, LCD-Rs van die analoge lijnen naar de digitale om te zetten

ik hou van werken ..., ik kan er uren naar kijken
KGE

Golden Member

Zoals fcapri al aangaf, die vier draden van SPI weglaten, dan heb je waarschijnlijk wel genoeg IO vanaf de ESP32.

Er is wel een kleine kans dat het scherm niet gaat werken op deze manier: de oude Arduino draait op 5 Volt voor zover ik weet en als dit scherm daar voor gemaakt is dan heeft het scherm 'level converters' voor de omzetting van 5 naar 3,3 Volt (scherm is intern 3,3V). Kwestie van proberen.

En anders inderdaad een kant en klaar SPI schermpje aanschaffen, scheelt een boel gedoe met IO pinnen.

En nu heb ik deze gevonden:
https://thesolaruniverse.wordpress.com/2021/06/01/esp32-wroom-32-and-u…

En sketch:
code:
// https://thesolaruniverse.wordpress.com/2021/06/01/esp32-wroom-32-and-u…
// ESP32_parallel_Uno_TFT_shield_radar_scope
// Board ESP32 Dev Module
// microcontroller ESP32-WROOM32
// display: Uno TFT shield 320*480 ILI9341 controller
// on ESP32 bench - only 5V jumper or 3V3 and 5V jumpers
// June 1, 2021
// original edited by Floris Wouterlood
// public domain

#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>

TFT_eSPI tft = TFT_eSPI(); // invoke custom library
// don't forget to update User_Setup.h
// some principal color definitions
// RGB 565 color picker at https://ee-programming-notepad.blogspot.com/2016/10/16-bit-color-gener…
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define GREY 0x2108
#define TEXT_COLOR 0xFFFF
#define SCOPE 0x3206 // custom scope CRT color

// center coordinates
// for screens bigger than 240x320 only change these two x-y coordinates

int center_x=120; // center x of radar scope on 240x320 TFT display
int center_y=160; // center y of radar scope on 240x320 TFT display

float edge_x =(center_x);
float edge_y =(center_y);
float edge_x_old = 0; // remembers previous edge x coordinate
float edge_y_old = 0; // remembers previous edge y coordinate
float edge_x_out = 0;
float edge_y_out = 0;
float angle = 0;
int j;
int radius = 110; // beam length - for 320x240 TFT screens
int scope_x = 0;
int scope_y = 0;
int sweepTime = 25;
int frametime = 250;

void setup() {

Serial.begin (9600);
Serial.println ();
Serial.println ();
Serial.println ("starting radar scope . .");

tft.init(); // initialize display
tft.setRotation (2); // set to landscape
tft.fillScreen (BLACK);
tft.setCursor (10, 10);
tft.setTextColor (WHITE);
tft.setTextSize (1);
Serial.println ("ESP32-WROOM32 and parallel interface TFT ILI9341");
Serial.println ("starting up......");
tft.println("radar scope initializing ......");
delay (1000);
tft.fillScreen (BLACK);
build_scope ();
}

void loop(void){

for (j=0;j<360;j++)
{
angle = (j*0.01745331); // angle expressed in radians - 1 degree = 0,01745331 radians
edge_coord (); // calculate beam
sweep_beam ();
tft.fillCircle (center_x,center_y,2,GREEN); // restore centerpoint
delay (sweepTime);
}
}

void build_scope (){

tft.drawRect (center_x-120, center_y-155, 254, 310, RED); // main contour
tft.drawRect (center_x-12, center_y-160, 30,11, RED); // edge decoration
tft.drawRect (center_x-12, center_y+150, 30,11, RED); // edge decoration

scope_x = (center_x+100); scope_y=(center_y-110); // right upper screw
screw ();
scope_x = (center_x-100); scope_y=(center_y-110); // left upper screw
screw ();
scope_x = (center_x-100); scope_y=(center_y+120); // left lower screw
screw ();
scope_x = (center_x+100); scope_y=(center_y+120); // right lower screw
screw ();

tft.drawCircle (center_x,center_y, (radius+1),RED); // scope CRT
tft.drawCircle (center_x,center_y, (radius+2),RED);
tft.fillCircle (center_x,center_y, radius,SCOPE);
tft.fillCircle (center_x,center_y, radius,SCOPE);
tft.fillCircle (center_x,center_y, 2,GREEN);
tft.drawCircle (center_x,center_y,60,GREEN);
tft.drawCircle (center_x,center_y,90,GREEN);
draw_scale ();
angle=0;
}

void edge_coord (){ // calculate beam tip coordinates and remember previous tip coordinates
edge_x_old = edge_x;
edge_y_old = edge_y;
edge_x = (center_x+(radius*cos(angle)));
edge_y = (center_y+(radius*sin(angle)));
}

void sweep_beam (){ // refresh beam by drawing and overdrawing old with scope color

tft.drawLine (center_x,center_y,edge_x_old,edge_y_old,SCOPE); // draw previous beam with scope color
tft.drawLine (center_x,center_y,edge_x,edge_y,GREEN);
}

void screw (){ // draw screw

tft.drawCircle (scope_x,scope_y, 6,RED);
tft.drawLine ((scope_x-11),scope_y,(scope_x+11),(scope_y),RED);
tft.drawLine (scope_x,(scope_y-11),scope_x,(scope_y+11),RED);
}

void draw_scale (){ // draw scale marker line segments on scope edge

j=0;
do {
angle = (j*0.01745331); // angle is expressed in radians - 1 degree = 0,01745331 radians
edge_x = (center_x + (radius*cos(angle)));
edge_y = (center_y + (radius*sin(angle)));
edge_x_out = (center_x + ((radius+8)*cos(angle)));
edge_y_out = (center_y + ((radius+8)*sin(angle)));
tft.drawLine (edge_x,edge_y, edge_x_out, edge_y_out,RED);
j = j+10;
} while (j<360);
}

Maar krijg deze foutmelgingen
Arduino: 1.8.18 (Windows 8.1), Board:"ESP32-WROOM-DA Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"

In file included from C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.h:100,

from C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:16:

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c: In function 'void dc_callback(spi_transaction_t*)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: 'GPIO' was not declared in this scope

189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:760:28: note: in expansion of macro 'DC_D'

760 | if ((bool)spi_tx->user) {DC_D;}

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:761:9: note: in expansion of macro 'DC_C'

761 | else {DC_C;}

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_write()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope

233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:80:5: note: in expansion of macro 'CS_L'

80 | CS_L;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::begin_nin_write()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope

233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:92:5: note: in expansion of macro 'CS_L'

92 | CS_L;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_write()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope

234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:106:7: note: in expansion of macro 'CS_H'

106 | CS_H;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::end_nin_write()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope

234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:121:7: note: in expansion of macro 'CS_H'

121 | CS_H;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_read()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:233:22: error: 'GPIO' was not declared in this scope

233 | #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:141:5: note: in expansion of macro 'CS_L'

141 | CS_L;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_read()':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope

234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:161:7: note: in expansion of macro 'CS_H'

161 | CS_H;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::writecommand(uint8_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:964:3: note: in expansion of macro 'DC_C'

964 | DC_C;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::writedata(uint8_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:189:22: error: 'GPIO' was not declared in this scope

189 | #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1012:3: note: in expansion of macro 'DC_D'

1012 | DC_D; // Play safe, but should already be in data mode

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'uint8_t TFT_eSPI::readcommand8(uint8_t, uint8_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1049:3: note: in expansion of macro 'DC_C'

1049 | DC_C; tft_Write_8(0xD9);

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual uint16_t TFT_eSPI::readPixel(int32_t, int32_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope

234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:1205:3: note: in expansion of macro 'CS_H'

1205 | CS_H;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::readRectRGB(int32_t, int32_t, int32_t, int32_t, uint8_t*)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:234:22: error: 'GPIO' was not declared in this scope

234 | #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:2209:3: note: in expansion of macro 'CS_H'

2209 | CS_H;

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::setWindow(int32_t, int32_t, int32_t, int32_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3419:5: note: in expansion of macro 'DC_C'

3419 | DC_C; tft_Write_8(TFT_CASET);

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'void TFT_eSPI::readAddrWindow(int32_t, int32_t, int32_t, int32_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3495:3: note: in expansion of macro 'DC_C'

3495 | DC_C; tft_Write_8(TFT_CASET);

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::drawPixel(int32_t, int32_t, uint32_t)':

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3677:7: note: in expansion of macro 'DC_C'

3677 | DC_C; tft_Write_8(TFT_CASET);

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3684:7: note: in expansion of macro 'DC_C'

3684 | DC_C; tft_Write_8(TFT_PASET);

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.h:188:22: error: 'GPIO' was not declared in this scope

188 | #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)

| ^~~~

C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:3690:3: note: in expansion of macro 'DC_C'

3690 | DC_C; tft_Write_8(TFT_RAMWR);

| ^~~~

exit status 1

Fout bij het compileren voor board ESP32-WROOM-DA Module

Een beetje verder maar hoe kan ik de foutmeldingen oplossen?

// don't forget to update User_Setup.h
Heb je in de library deze file aangepast voor jouw display ? Er staat een lijst met in met displays, je moet jouw display "un commenten" :
Vb, hier is display "#define ILI9341_DRIVER " actief.

// Only define one driver, the other ones must be commented out
#define ILI9341_DRIVER       // Generic driver for common displays
//#define ILI9341_2_DRIVER     // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER      // Define additional parameters below for this display
//#define ILI9163_DRIVER     // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER     // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
//#define ST7789_DRIVER      // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER    // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER

Bedankt RP6conrad, mogelijk moet ik dit nog aanpassen maar ik heb dit nog nooit gedaan en weet dus nog niet hoe.
Is het in de bibliotheek TFT_eSPI.h ? en dan klikken op More Info ?
Dan kom ik op https://github.com/Bodmer/TFT_eSPI , en hoe geraak ik dan verder?
Of zit ik helemaal mis?

Dan kom ik op https://github.com/Bodmer/TFT_eSPI , en hoe geraak ik dan verder? Of zit ik helemaal mis?

Je zit helemaal mis, je moet je file User_Setup.h lokaal op je computer aanpassen.

It's the rule that you live by and die for It's the one thing you can't deny Even though you don't know what the price is. It is justified.

Als ik op mijn pc in de zoekfunctie User_Setup.h geef dan krijg ik 2 bestanden, namelijk:

C:\Users\Looitje\Documents\Arduino\libraries\TFT_ILI9341_ESP-master
en
C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI

In beide staat User Setup.h als ik daar op klik krijg ik een scherm met tekst die helemaal niet overzichtelijk is, niet zoals RP6conrad voorstelde.

En hoe kan ik verder?

Deze file moet je inderdaad aanpassen : C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\User_setup.h
Je zoekt jouw type scherm, alleen bij deze definitie verwijder je dan de "//" vooraan. Dit zijn de "commentaar" tekens. Alle andere schermen moeten wel "//" deze tekens hebben !
Dit is inderdaad vrij ongebruikelijk, omdat deze library telkens moet aangepast worden als je een ander scherm gebruikt.

Open User_Setup_Select.h met notepad++ of gelijkaardig. Met word of een andere tekstverwerker maak je het helemaal onleesbaar.

Zoek eerst uit welke driver IC er op je bord zit.

#include <User_Setup.h> 

wijzigen in

//#include <User_Setup.h> 

Verder in de lijst zoeken naar jou driver IC en aansluitmethode.
Heb je uw situatie gevonden? Daar de // weghalen.
Mogelijk moet je ook nog de bijhorende setup file wat aanpassen. Bijvoorbeeld de gebruikte uitgangen. Maak dan best een copy met eigen nummer. Anders ben je de standaard instelling kwijt. (Volgende stap is die eigen file verplaatsen zoals onderaan beschreven)

Op dinsdag 19 november 2024 16:13:10 schreef RP6conrad:
Deze file moet je inderdaad aanpassen : C:\Users\Looitje\Documents\Arduino\libraries\TFT_eSPI\User_setup.h
Je zoekt jouw type scherm, alleen bij deze definitie verwijder je dan de "//" vooraan. Dit zijn de "commentaar" tekens. Alle andere schermen moeten wel "//" deze tekens hebben !
Dit is inderdaad vrij ongebruikelijk, omdat deze library telkens moet aangepast worden als je een ander scherm gebruikt.

Normaal pas je User_Setup_Select.h aan. Daar zit meer achter de definities dan in User_Setup.h.

Bodmer heeft een tijd geëxperimenteerd met de setup in een .h file in de project map. Maar dat werkte niet op elke computer correct. Bij de ene was oplossing x voldoende. Bij een ander was het dat net niet en weer een andere instelling.

Bodmer beschrijft wel hoe je een persoonlijke setup map kunt aanmaken. Plaats je eigen setup in de standaard map, dan worden deze gewist met een update. Een aparte map voorkomt dit. Op die manier kan ik voor elk project een eigen setup maken. Zelfde driver, andere pennen gebruikt, .... Het enige wat ik na een update moet doen is een kleine aanpassing in de Bodmer map.

Tips

If you load a new copy of TFT_eSPI then it will overwrite your setups if they are kept within the TFT_eSPI folder. One way around this is to create a new folder in your Arduino library folder called "TFT_eSPI_Setups". You then place your custom setup.h files in there. After an upgrade simply edit the User_Setup_Select.h file to point to your custom setup file e.g.:

#include <../TFT_eSPI_Setups/my_custom_setup.h>

You must make sure only one setup file is called. In the custom setup file I add the file path as a commented out first line that can be cut and pasted back into the upgraded User_Setup_Select.h file. The ../ at the start of the path means go up one directory level. Clearly you could use different file paths or directory names as long as it does not clash with another library or folder name.

You can take this one step further and have your own setup select file and then you only need to replace the Setup.h line reference in User_Setup_Select.h to, for example:

#include <../TFT_eSPI_Setups/my_setup_select.h>

To select a new setup you then edit your own my_setup_select.h file (which will not get overwritten during an upgrade).

Van Lambiek wordt goede geuze gemaakt.

Ik heb de User_Setup.h bekeken en daar staat #define ILI9341_DRIVER zonder // dus dat is oké.
Ik heb Board ESP32 Dev Module geselecteerd maar dat is misschien mis.
Wat kan ik nog doen?

Normaal moet je niks wijzigen in User-Setup.h, maar maak je de keuze in Uset-Setup-Select.h Dat is dan het enige project-specifieke bestand dat buiten de library blijft en binnen je project. Daarin kies je dan de configuratie.

Dus in User_Setup_Select.h zou ik eens proberen met :
//#include <User_Setups/Setup14_ILI9341_Parallel.h> // Setup file for the ESP32 with parallel bus TFT

Kijk daarna naar de Setup14-ILI9341_Parallel.h of de aansluitingen kloppen met wat jij hebt gemaakt. Het eenvoudigste is de aansluitingen uit het bestand gebruiken. Zeker de eerste maal.

// See SetupX_Template.h for all options available
#define USER_SETUP_ID 14

#define TFT_PARALLEL_8_BIT


#define ILI9341_DRIVER


// ESP32 pins used for the parallel interface TFT
#define TFT_CS   33  // Chip select control pin
#define TFT_DC   15  // Data Command control pin - must use a pin in the range 0-31
#define TFT_RST  32  // Reset pin

#define TFT_WR    4  // Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD    2

#define TFT_D0   12  // Must use pins in the range 0-31 for the data bus
#define TFT_D1   13  // so a single register write sets/clears all bits
#define TFT_D2   26
#define TFT_D3   25
#define TFT_D4   17
#define TFT_D5   16
#define TFT_D6   27
#define TFT_D7   14


#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

Door bepaalde fonts in commentaar te zetten, kan je ook nog wat geheugen sparen. Doe dat als alles werkt met een nieuwe setup_file en voeg de correcte benaming toe in User_Setup_Select.h. Nog beter zoals beschreven in mijn vorige reactie.

Van Lambiek wordt goede geuze gemaakt.

Ik heb 3.5" TFT LCD Shield zoals op foto en die heeft geen DC pin.
De tft op foto is dat wel de ILI9341 ? Zijn we misschien daarom verkeerd naar de oplossing aan het zoeken ?

Ik heb ook zoiets liggen, resolutie 320x480, driver IC ILI9486.

Op woensdag 20 november 2024 16:24:34 schreef Looier:
Ik heb 3.5" TFT LCD Shield zoals op foto en die heeft geen DC pin.
De tft op foto is dat wel de ILI9341 ? Zijn we misschien daarom verkeerd naar de oplossing aan het zoeken ?

Waar heb je het vandaan? Dan krijg je wat meer zekerheid rond de gebruikte processor. Andere processor is andere manier van initialiseren en aansturen.

Van Lambiek wordt goede geuze gemaakt.
Arco

Special Member

Opdruk op de printplaten klopt vaak niet met de werkelijkheid of heet anders...
De DC pin (Data/Command) is hier de LCD_RS pin. (Register Select)

Arco - "Simplicity is a prerequisite for reliability" - hard-, firm-, en software ontwikkeling: www.arcovox.com

Hij werkt wel op je UNO... Dan kun je daar toch zien hoe het daar is geconfigureerd?

In de Arduino Uno heb ik deze schets gebruikt:

#include <SoftwareSerial.h>
#include "Adafruit_GFX.h"// Algemene bibliotheek voor grafische lcd schermen
#include <MCUFRIEND_kbv.h> //specifieke bibliotheek voor dit type scherm

MCUFRIEND_kbv tft; //koppel de functie tft aan de bibliotheek

//definieer de kleuren die we kunnen gebruiken
#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 LCD_CS A3 // Chip Select
#define LCD_CD A2 // Command/Data
#define LCD_WR A1 // LCD Write
#define LCD_RD A0 // LCD Read
#define LCD_RESET A4 // LCD Reset
int a;

void setup(){
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier); //Start het lcd scherm
tft.fillScreen(black); //vul het scherm op in de kleur zwart
tft.setRotation(1); //0-3 //Stel het scherm in op horizontaal met de text boven de buttons
tft.setTextSize(7);
tft.setTextColor ( green , black);
tft.setCursor(10,10);
tft.print("Arduino Uno");
tft.setCursor(102,130);
tft.print("3.5 TFT");
tft.setCursor(31,240);
tft.print("LCD Shield");
}
void loop(){}

aangezien je geen analoge uitgangen hebt op de ESP, moet die die A0 tot A4 aan andere digitale poorten hangen, en die kabeltjes dan ook correct daar aan zetten

#define LCD_CS A3 // Chip Select
#define LCD_CD A2 // Command/Data
#define LCD_WR A1 // LCD Write
#define LCD_RD A0 // LCD Read
#define LCD_RESET A4 // LCD Reset

die code zou dan ook gewoon moeten werken op ESP. zorg dat je dit aan de praat hebt, voor je met andere libraries begint

[Bericht gewijzigd door fcapri op donderdag 21 november 2024 07:37:49 (15%)

ik hou van werken ..., ik kan er uren naar kijken

Van de MCUFRIEND_kbv librarie kan je ook steeds diagnose_TFT_support.ino eens gebruiken. Dan krijg je meer informatie over de gebruikte processor en de resolutie.

Van Lambiek wordt goede geuze gemaakt.

Ik heb nu de verbinding tussen Arduino Uno en TFT LCD Shield getest en dit zijn de nodige aansluitingen:

Arduino Uno > TFT LCD Shield

analoog A0 > LCD RD
analoog A1 > LCD WR
analoog A2 > LCD CS
analoog A3 > LCD WS
analoog A4 > LCD RST
digitaal 2 > LCD D2
digitaal 3 > LCD D3
digitaal 4 > LCD D4
digitaal 5 > LCD D5
digitaal 6 > LCD D6
digitaal 7 > LCD D7
digitaal 8 > LCD D0
digitaal 9 > LCD D1

De voeding moet 5 volt zijn, op 3.3volt geen beeld.
In totaal 15 aansluitingen en die zijn echt allemaal nodig
In welke bibliotheek kan ik dit best aanpassen voor de ESP32 ? Voor de analoge heb ik het al gezien maar de digitale zijn ook nodig. Of een betere/eenvoudige oplossing ? Ik wil wel met mijn ESP en mijn LCd verder doen indien mogelijk.

De pin nummers voor ESP32 liggen al vast in Setup14-ILI9341_Parallel.h Zie hierboven.

Maar het is de vraag of je wel een ILI9341 hebt. Dat is nog niet zeker.