#include<TFT_eSPI.h>
#include<SPI.h>
#include <Wire.h>
#include<Adafruit_FT6206.h>
Adafruit_FT6206 ctp_0 = Adafruit_FT6206();
int tft_cs=15;
int tft_dc=2;
int tft_mosi=23;
int tft_sclk=18;
TFT_eSPI tft= TFT_eSPI();
void setup() {
tft.begin();
Serial.begin(115200);
Serial.println("Hello, ESP32!");
if(!ctp_0.begin(40))
{
while(1);
}
tft.fillScreen(ILI9341_BLACK);
}
void loop() {
if(!ctp_0.touched())
{
delay(10);
return;
}
TS_Point P= ctp_0.getPoint();
P.x=map(P.x,0,240,240,0);
P.y=map(P.y,0,320,320,0);
Serial.print(P.x);
Serial.print(",");
Serial.print(P.y);
Serial.println("");
// put your main code here, to run repeatedly:
delay(100); // this speeds up the simulation
}