ik probeer een display aan een ESP32 te zetten maar dat lukt niet want hij geeft alleen maar wit beeld
Ja, heel vervelend is dat.
Ja dat vind ik ook maar zou je mij daar bij kunnen helpen om dat te fiksen
Het kan handig zijn als je ons kunt vertellen welk display dat precies is en bij voorkeur welke chip erop zit. En welke programma je in de ESP32 hebt zitten.
Ik heb geen verstand van dit soort displays (ook niet van de ESP32) dus kan je niet verder helpen. Ik weet niet hoe goed je Engels is, maar je zou eens kunnen zoeken in de Displays sectie van het forum.
Ik ken het scherm niet, maar hier vindt je waarschijnlijk een werkend voorbeeld
Mijn antwoord was dus even nuttig als jouw vraag was.
Je noemt je ESP en een ILI9486, dat het niet je lukt en een wit scherm ziet.
Je hebt niets verteld over wat je al geprobeerd hebt, hoe je het ding hebt aangesloten en wat je wil doen.
Als je geen vraag stelt kun je ook geen antwoord verwachten.
#define TFT_BL 15 // LED back-light control pin
#define TFT_PARALLEL_8_BIT
// The ESP32 and TFT the pins used for testing are:
#define TFT_CS -1 // Case Select pin, Set to GND
#define TFT_DC 02 // (RS/DC) Register Select / Data Command control pin - must use a pin in the range 0-31
#define TFT_RST -1 // Reset pin, toggles on startup, set to EN
#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD 0 // Read strobe control pin
#define TFT_D0 13 // Must use pins in the range 0-31 for the data bus
#define TFT_D1 12 // so a single register write sets/clears all bits.
#define TFT_D2 14 // Pins can be randomly assigned, this does not affect
#define TFT_D3 27 // TFT screen update performance.
#define TFT_D4 26
#define TFT_D5 25
#define TFT_D6 16
#define TFT_D7 17
#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF
op deze manier heb ik het aangesloten mijn display is een huga 480x320
3,5 inch TFTLCD Shield
driver:ILI9486
ik heb gerprobeert de code te veranderen maar dat hielp ook niet ander codes ook gepobeert maar dat hielp ook niet
ik maak op zolder een bestuuings programa om stopcontacten te bedienen via blink maar nu zou ik graag ook een dislpay in bouwen alleen dat lukt nog niet echt
dus het zou wel fijn zijn als iemand mij kan helpen ik ben ook noch niet zo lang met arduino bezig en ook noch niet zo goed met codes
De code die je hier hebt gezet is echt nog geen programma. Enige wat je doet is declareren wat de compiler moet invullen in plaats van de genoemde waarde.
als voorbeeld: overal waar jij TFT_D0 in de code schrijft zet de compiler 13 neer. Het is een manier om voor mensen betekenis volle namen te kunnen gebruiken in plaats van het niets zeggende nummer 13.
Het volgende is een compleet programma.
Probeer deze code eens. Zorg wel dat je de library's Adafruit_GFX.h en Waveshare_ILI9486.h hebt geinstalleerd anders krijg je foutmeldingen.
#include <Arduino.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Waveshare_ILI9486.h>
// 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
namespace
{
Waveshare_ILI9486 Waveshield;
// Provide an alias so I don't have to search-and-replace all the code below.
Adafruit_GFX &tft = Waveshield;
//
// This is all copied from the original 'Waveshare _ILI9486' project.
unsigned long testFillScreen();
unsigned long testText();
unsigned long testLines(uint16_t color);
unsigned long testFastLines(uint16_t color1, uint16_t color2);
unsigned long testRects(uint16_t color);
unsigned long testFilledRects(uint16_t color1, uint16_t color2);
unsigned long testFilledCircles(uint8_t radius, uint16_t color);
unsigned long testCircles(uint8_t radius, uint16_t color);
unsigned long testTriangles();
unsigned long testFilledTriangles();
unsigned long testRoundRects();
unsigned long testFilledRoundRects();
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
{
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3);
}
typedef struct
{
PGM_P msg;
uint32_t ms;
} TEST;
TEST result[12];
#define RUNTEST(n, str, test) { result[n].msg = PSTR(str); result[n].ms = test; delay(500); }
void runtests(void)
{
uint8_t i, len = 24;
uint32_t total;
RUNTEST(0, "FillScreen ", testFillScreen());
yield();
RUNTEST(1, "Text ", testText());
yield();
RUNTEST(2, "Lines ", testLines(CYAN));
yield();
RUNTEST(3, "Horiz/Vert Lines ", testFastLines(RED, BLUE));
yield();
RUNTEST(4, "Rectangles (outline) ", testRects(GREEN));
yield();
RUNTEST(5, "Rectangles (filled) ", testFilledRects(YELLOW, MAGENTA));
yield();
RUNTEST(6, "Circles (filled) ", testFilledCircles(10, MAGENTA));
yield();
RUNTEST(7, "Circles (outline) ", testCircles(10, WHITE));
yield();
RUNTEST(8, "Triangles (outline) ", testTriangles());
yield();
RUNTEST(9, "Triangles (filled) ", testFilledTriangles());
yield();
RUNTEST(10, "Rounded rects (outline) ", testRoundRects());
yield();
RUNTEST(11, "Rounded rects (filled) ", testFilledRoundRects());
tft.fillScreen(BLACK);
tft.setTextColor(GREEN);
tft.setCursor(0, 0);
uint16_t wid = tft.width();
if (wid > 176)
{
tft.setTextSize(2);
#if defined(MCUFRIEND_KBV_H_)
tft.print("MCUFRIEND ");
#if MCUFRIEND_KBV_H_ != 0
tft.print(0.01 * MCUFRIEND_KBV_H_, 1);
#else
tft.print("for");
#endif
tft.println(" UNO");
#else
tft.println("Adafruit-Style Tests");
#endif
}
else len = wid / 6 - 8;
tft.setTextSize(1);
total = 0;
for (i = 0; i < 12; i++)
{
PGM_P str = result[i].msg;
char c;
if (len > 24)
{
if (i < 10) tft.print(" ");
tft.print(i);
tft.print(": ");
}
uint8_t cnt = len;
while ((c = pgm_read_byte(str++)) && cnt--) tft.print(c);
tft.print(" ");
tft.println(result[i].ms);
total += result[i].ms;
}
tft.setTextSize(2);
tft.print("Total:");
tft.print(0.000001 * total);
tft.println("sec");
//g_identifier = tft.readID();
//tft.print("ID: 0x");
//tft.println(tft.readID(), HEX);
//tft.print("Reg(00):0x");
//tft.println(tft.readReg(0x00), HEX);
tft.print("F_CPU:");
tft.print(0.000001 * F_CPU);
#if defined(__OPTIMIZE_SIZE__)
tft.println("MHz -Os");
#else
tft.println("MHz");
#endif
delay(10000);
}
// Standard Adafruit tests. will adjust to screen size
unsigned long testFillScreen()
{
unsigned long start = micros();
tft.fillScreen(BLACK);
tft.fillScreen(RED);
tft.fillScreen(GREEN);
tft.fillScreen(BLUE);
tft.fillScreen(BLACK);
return micros() - start;
}
unsigned long testText()
{
unsigned long start;
tft.fillScreen(BLACK);
start = micros();
tft.setCursor(0, 0);
tft.setTextColor(WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(YELLOW); tft.setTextSize(2);
tft.println(123.45);
tft.setTextColor(RED); tft.setTextSize(3);
tft.println(0xDEADBEEF, HEX);
tft.println();
tft.setTextColor(GREEN);
tft.setTextSize(5);
tft.println("Groop");
tft.setTextSize(2);
tft.println("I implore thee,");
tft.setTextSize(1);
tft.println("my foonting turlingdromes.");
tft.println("And hooptiously drangle me");
tft.println("with crinkly bindlewurdles,");
tft.println("Or I will rend thee");
tft.println("in the gobberwarts");
tft.println("with my blurglecruncheon,");
tft.println("see if I don't!");
return micros() - start;
}
unsigned long testLines(uint16_t color)
{
unsigned long start, t;
int x1, y1, x2, y2,
w = tft.width(),
h = tft.height();
tft.fillScreen(BLACK);
x1 = y1 = 0;
y2 = h - 1;
start = micros();
for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
x2 = w - 1;
for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
t = micros() - start; // fillScreen doesn't count against timing
tft.fillScreen(BLACK);
x1 = w - 1;
y1 = 0;
y2 = h - 1;
start = micros();
for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
x2 = 0;
for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
t += micros() - start;
tft.fillScreen(BLACK);
x1 = 0;
y1 = h - 1;
y2 = 0;
start = micros();
for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
x2 = w - 1;
for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
t += micros() - start;
tft.fillScreen(BLACK);
x1 = w - 1;
y1 = h - 1;
y2 = 0;
start = micros();
for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
x2 = 0;
for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
return micros() - start;
}
unsigned long testFastLines(uint16_t color1, uint16_t color2)
{
unsigned long start;
int x, y, w = tft.width(), h = tft.height();
tft.fillScreen(BLACK);
start = micros();
for (y = 0; y < h; y += 5) tft.drawFastHLine(0, y, w, color1);
for (x = 0; x < w; x += 5) tft.drawFastVLine(x, 0, h, color2);
return micros() - start;
}
unsigned long testRects(uint16_t color)
{
unsigned long start;
int n, i, i2,
cx = tft.width() / 2,
cy = tft.height() / 2;
tft.fillScreen(BLACK);
n = min(tft.width(), tft.height());
start = micros();
for (i = 2; i < n; i += 6)
{
i2 = i / 2;
tft.drawRect(cx - i2, cy - i2, i, i, color);
}
return micros() - start;
}
unsigned long testFilledRects(uint16_t color1, uint16_t color2)
{
unsigned long start, t = 0;
int n, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(BLACK);
n = min(tft.width(), tft.height());
for (i = n; i > 0; i -= 6)
{
i2 = i / 2;
start = micros();
tft.fillRect(cx - i2, cy - i2, i, i, color1);
t += micros() - start;
// Outlines are not included in timing results
tft.drawRect(cx - i2, cy - i2, i, i, color2);
yield();
}
return t;
}
unsigned long testFilledCircles(uint8_t radius, uint16_t color)
{
unsigned long start;
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;
tft.fillScreen(BLACK);
start = micros();
for (x = radius; x < w; x += r2)
{
for (y = radius; y < h; y += r2)
{
tft.fillCircle(x, y, radius, color);
}
}
return micros() - start;
}
unsigned long testCircles(uint8_t radius, uint16_t color)
{
unsigned long start;
int x, y, r2 = radius * 2,
w = tft.width() + radius,
h = tft.height() + radius;
// Screen is not cleared for this one -- this is
// intentional and does not affect the reported time.
start = micros();
for (x = 0; x < w; x += r2)
{
for (y = 0; y < h; y += r2)
{
tft.drawCircle(x, y, radius, color);
}
}
return micros() - start;
}
unsigned long testTriangles()
{
unsigned long start;
int n, i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(BLACK);
n = min(cx, cy);
start = micros();
for (i = 0; i < n; i += 5)
{
tft.drawTriangle(
cx, cy - i, // peak
cx - i, cy + i, // bottom left
cx + i, cy + i, // bottom right
color565(0, 0, i));
}
return micros() - start;
}
unsigned long testFilledTriangles()
{
unsigned long start, t = 0;
int i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(BLACK);
start = micros();
for (i = min(cx, cy); i > 10; i -= 5)
{
start = micros();
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
color565(0, i, i));
t += micros() - start;
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
color565(i, i, 0));
}
return t;
}
unsigned long testRoundRects()
{
unsigned long start;
int w, i, i2, red, step,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(BLACK);
w = min(tft.width(), tft.height());
start = micros();
red = 0;
step = (256 * 6) / w;
for (i = 0; i < w; i += 6)
{
i2 = i / 2;
red += step;
tft.drawRoundRect(cx - i2, cy - i2, i, i, i / 8, color565(red, 0, 0));
}
return micros() - start;
}
unsigned long testFilledRoundRects()
{
unsigned long start;
int i, i2, green, step,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(BLACK);
start = micros();
green = 256;
step = (256 * 6) / min(tft.width(), tft.height());
for (i = min(tft.width(), tft.height()); i > 20; i -= 6)
{
i2 = i / 2;
green -= step;
tft.fillRoundRect(cx - i2, cy - i2, i, i, i / 8, color565(0, green, 0));
yield();
}
return micros() - start;
}
void RunSpeedTest()
{
unsigned long total = 0;
unsigned long delta = 0;
Serial.println(F("Benchmark Time (microseconds)"));
delay(10);
Serial.print(F("Screen fill "));
Serial.println(delta = testFillScreen());
total += delta;
delay(500);
Serial.print(F("Text "));
Serial.println(delta = testText());
total += delta;
delay(3000);
Serial.print(F("Lines "));
Serial.println(delta = testLines(CYAN));
total += delta;
delay(500);
#if 0
Serial.print(F("Horiz/Vert Lines "));
Serial.println(testFastLines(ILI9486_RED, ILI9486_BLUE));
delay(500);
#endif
Serial.print(F("Rectangles (outline) "));
Serial.println(delta = testRects(GREEN));
total += delta;
delay(500);
Serial.print(F("Rectangles (filled) "));
Serial.println(delta = testFilledRects(YELLOW, MAGENTA));
total += delta;
delay(500);
Serial.print(F("Circles (filled) "));
Serial.println(delta = testFilledCircles(10, MAGENTA));
total += delta;
Serial.print(F("Circles (outline) "));
Serial.println(delta = testCircles(10, WHITE));
total += delta;
delay(500);
#if 0
Serial.print(F("Triangles (outline) "));
Serial.println(testTriangles());
delay(500);
Serial.print(F("Triangles (filled) "));
Serial.println(testFilledTriangles());
delay(500);
Serial.print(F("Rounded rects (outline) "));
Serial.println(testRoundRects());
delay(500);
Serial.print(F("Rounded rects (filled) "));
Serial.println(testFilledRoundRects());
delay(500);
#endif
Serial.println(F("Done!"));
Serial.println(total);
}
}
void setup()
{
Serial.begin(115200);
while (!Serial);
SPI.begin();
Waveshield.begin();
}
// the loop function runs over and over again until power down or reset
void loop()
{
// Run the Adafruit tests.
// We'll run using a different rotation to show that everything works!
tft.setRotation(2);
runtests();
// Run the smaller set that the original Waveshare driver did. For comparison, the
// original code ran in about 71 seconds on a Mega.
tft.setRotation(0);
RunSpeedTest();
// Show how text prints under different rotations.
tft.fillScreen(BLUE);
for (int i = 0; i < 4; i++)
{
// Changing rotation should NOT affect anything currently on the screen!
tft.setRotation(i);
tft.print("Hello World! ");
tft.println(i);
delay(1000);
}
tft.invertDisplay(true);
delay(3000);
tft.invertDisplay(false);
delay(3000);
}
Bedankt Frits1956 maar hoe moet ik het scherm aansluiten aan mijn ESP32 Ik ga het maandag uitproberen dan hoor je noch of het gelukt is
het lukt op de een of andere manier of zo niet super jammer ![]()
Kun je voor de zekerheid ook nog een foto van jouw ESP tonen ?
De pinnummers staan al vermeld op het boardje, maar onderstaand een iets beter leesbaar en uitgebreidere variant.
Sla het op op je PC zodat je het er altijd even bij kunt pakken als je er nog eens mee aan de gang gaat in de toekomst:
Lees de opmerkingen in je sketch nog eens en vergelijk het met dit plaatje zou ik zeggen.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.


