/* 9468FT6236ESP32V1 */ #include "TFT_eSPI.h" #include "FT6236.h" TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with default width and height FT6236 ts = FT6236(); void setup() { Serial.begin(115200); Serial.println("9468FT6236ESP32V1"); tft.begin(); tft.init(); tft.setRotation(2); tft.fillScreen(TFT_RED); tft.drawRect(0,0,319,476,TFT_WHITE);//screen seems to only display 476 wide, rest is hidden under black surround tft.drawRect(10,10,10,10,TFT_WHITE);//just to let me know top corner tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setCursor(40,40); tft.println("Some Text"); if (!ts.begin(40)) { Serial.println("Unable to start the capacitive touchscreen."); } } void loop() { // put your main code here, to run repeatedly: touchProcess(); } void touchProcess() { int q; int xTouch; int yTouch; //deal with screen presses //if (currentMillis - screenMillis >= screenTimer) { if (ts.touched()) { //screenMillis = currentMillis; //reset debounce only if screen pressed // Retrieve a point TS_Point p = ts.getPoint(); xTouch = p.x; xTouch = map(xTouch, 316, 10, 0, 319); if (xTouch < 0) { xTouch = 0; } if (xTouch > 319) { xTouch = 319; } Serial.println("x:" + String(xTouch)); yTouch = p.y; yTouch = map(yTouch, 463, 2, 0, 479); if (yTouch < 0) { yTouch = 0; } if (yTouch > 479) { yTouch = 479; } Serial.println("y:" + String(yTouch)); } //} }