Hallo meine lieben Freunde, ich bin grade an meinem zweiten µC Controller Projekt und auch so gut wie fertig, jedoch bin ich auf ein kleines Problem gestoßen. Folgendes Projekt: NodeMCU ESP8266 mit 2,4" TFT Bildschirm mit ILI9341 Controller (https://www.ebay.de/itm/282990458619). Funktion: Wecker. Per Touchscreen soll die Eingabe von Weckzeiten etc. Ermöglicht werden. Jedoch passiert es manchmal (und inzwischen sehr häufig) dass nach einiger Benutztung des Touchscreens der Bildschirm plötzlich weiß wird, und der µC resettet werden muss. Hier mal meine Verkabelung des Bildschirms VCC to 3.3V GND to GND CS to D8 RESET to RST DC to D4 SDI (MOSI) to D7 SCK to D5 LED to 3.3V SDD (MISO) to D6 T_CLK to D5 T_CS to D2 T_DIN to D7 T_DO to D6 T_IRQ to D1 und der erstmal der wichtige Teil meines Codes:
1 | #include <Wire.h> |
2 | #include <SPI.h> |
3 | #include "Adafruit_ILI9341esp.h" |
4 | #include "Adafruit_GFX.h" |
5 | #include "XPT2046.h" |
6 | |
7 | #define TFT_DC 2
|
8 | #define TFT_CS 15
|
9 | |
10 | Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); |
11 | XPT2046 touch(/*cs=*/ 4, /*irq=*/ 5); |
12 | void setup(){ |
13 | SPI.setFrequency(ESP_SPI_FREQ); |
14 | pinMode(2, OUTPUT); //hab gelesen dass das bei Whitescreens helfen soll tuts aber nicht... |
15 | tft.begin(); |
16 | touch.begin(tft.width(), tft.height()); // Must be done before setting rotation |
17 | tft.setRotation(1); |
18 | tft.fillScreen(ILI9341_BLACK); |
19 | touch.setCalibration(220, 256, 1776, 1795); |
20 | tft.setTextColor(ILI9341_WHITE); |
21 | }
|
22 | void loop() |
23 | {
|
24 | x = -1; y = -1; |
25 | if (touch.isTouching()) { |
26 | touch.getPosition(y, x); |
27 | Serial.print(x); Serial.print(" "); Serial.println(y); |
28 | }
|
29 | if (alarm() == true && mute == false) screen = 1; |
30 | if (screen == 0) Mainscreen(); |
31 | else if (screen == 1) Alarmscreen(); |
32 | }
|
Der Touch wird auch mit weißem Display noch erkannt. Hat jemand eine Idee woran das liegen könnte? vielen lieben Dank im vorraus!