Hi,
I bought a TFT TJCTM24024-SPI which uses a XPT2046 to manage the touchscreen.
luckely I found the Library for it at
https://github.com/PaulStoffregen/X...b/master/examples/ILI9341Test/ILI9341Test.ino
because of my small breadboard I tried to make mostly short wires and used some pins of my T36 near to the TFT to keep it with short wires.
I used Ping 29 for TIRQ_PIN and 28 for CS.
How to wire up T_D0, T_DIN and T_CLK??? I my case I did not wire them to anything.
Only using CS or CS and T_IRQ it does not detect any Touch-Event and shows only
X = 8191
Y = 8191
.. because of showing something, the display-hardware and the upload of code works fine.
ARDUINO 1.8.9
Here is the example which I changed in the Pinout for the TFT and the Touch.
I bought a TFT TJCTM24024-SPI which uses a XPT2046 to manage the touchscreen.
luckely I found the Library for it at
https://github.com/PaulStoffregen/X...b/master/examples/ILI9341Test/ILI9341Test.ino
because of my small breadboard I tried to make mostly short wires and used some pins of my T36 near to the TFT to keep it with short wires.
I used Ping 29 for TIRQ_PIN and 28 for CS.
How to wire up T_D0, T_DIN and T_CLK??? I my case I did not wire them to anything.
Only using CS or CS and T_IRQ it does not detect any Touch-Event and shows only
X = 8191
Y = 8191
.. because of showing something, the display-hardware and the upload of code works fine.
ARDUINO 1.8.9
Here is the example which I changed in the Pinout for the TFT and the Touch.
Code:
#include <ILI9341_t3.h>
#include <font_Arial.h> // from ILI9341_t3
#include <XPT2046_Touchscreen.h>
#include <SPI.h>
// Touch-Pins
#define CS_PIN 28
#define TIRQ_PIN 29
// TFT-Pins
#define TFT_DC 20
#define TFT_CS 21
#define TFT_RST 255 // 255 = unused, connect to 3.3V
#define TFT_MOSI 7
#define TFT_SCLK 14
#define TFT_MISO 12
XPT2046_Touchscreen ts( CS_PIN, TIRQ_PIN );
// For the Adafruit shield, these are the default
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
void setup() {
Serial.begin(115000);
tft.begin();
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
ts.begin();
ts.setRotation(1);
while (!Serial && (millis() <= 1000));
}
boolean wastouched = true;
void loop() {
boolean istouched = ts.touched();
if (istouched) {
TS_Point p = ts.getPoint();
if (!wastouched) {
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_YELLOW);
tft.setFont(Arial_60);
tft.setCursor(60, 80);
tft.print("Touch");
}
tft.fillRect(100, 150, 140, 60, ILI9341_BLACK);
tft.setTextColor(ILI9341_GREEN);
tft.setFont(Arial_24);
tft.setCursor(100, 150);
tft.print("X = ");
tft.print(p.x);
tft.setCursor(100, 180);
tft.print("Y = ");
tft.print(p.y);
Serial.print(", x = ");
Serial.print(p.x);
Serial.print(", y = ");
Serial.println(p.y);
} else {
if (wastouched) {
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_RED);
tft.setFont(Arial_48);
tft.setCursor(120, 50);
tft.print("No");
tft.setCursor(80, 120);
tft.print("Touch");
}
Serial.println("no touch");
}
wastouched = istouched;
delay(100);
}