From e0f6a706659aef4e99dce9a4b6e130c489b550db Mon Sep 17 00:00:00 2001 From: Hamid Saffari <35362339+HamidSaffari@users.noreply.github.com> Date: Fri, 27 Mar 2020 17:14:42 +0430 Subject: [PATCH] Delete Touch_calibrate_Print_on_LCD.ino --- .../Touch_calibrate_Print_on_LCD.ino | 102 ------------------ 1 file changed, 102 deletions(-) delete mode 100644 Touch_calibrate_Print_on_LCD/Touch_calibrate_Print_on_LCD.ino diff --git a/Touch_calibrate_Print_on_LCD/Touch_calibrate_Print_on_LCD.ino b/Touch_calibrate_Print_on_LCD/Touch_calibrate_Print_on_LCD.ino deleted file mode 100644 index 94f93fd..0000000 --- a/Touch_calibrate_Print_on_LCD/Touch_calibrate_Print_on_LCD.ino +++ /dev/null @@ -1,102 +0,0 @@ -/* - Sketch to generate the setup() calibration values, these are reported - to the Serial Monitor. - - The sketch has been tested on the ESP8266 and screen with XPT2046 driver. -*/ - -#include -#include // Hardware-specific library - -TFT_eSPI tft = TFT_eSPI(); // Invoke custom library - -//------------------------------------------------------------------------------------------ - -void setup() { - // Use serial port - //Serial.begin(115200); - - // Initialise the TFT screen - tft.init(); - - // Set the rotation before we calibrate - tft.setRotation(1); - - // Calibrate the touch screen and retrieve the scaling factors - touch_calibrate(); - -/* - // Replace above line with the code sent to Serial Monitor - // once calibration is complete, e.g.: - uint16_t calData[5] = { 286, 3534, 283, 3600, 6 }; - tft.setTouch(calData); -*/ - - // Clear the screen - tft.setTextColor(TFT_YELLOW, TFT_BLACK); - tft.drawCentreString("Touch screen to test!",tft.width()/2, tft.height()/2, 2); - tft.setTextColor(TFT_WHITE, TFT_BLACK); -} - -//------------------------------------------------------------------------------------------ - -void loop(void) { - uint16_t x = 0, y = 0; // To store the touch coordinates - - // Pressed will be set true is there is a valid touch on the screen - boolean pressed = tft.getTouch(&x, &y); - - // Draw a white spot at the detected coordinates - if (pressed) { - tft.fillCircle(x, y, 2, TFT_WHITE); - tft.setCursor(20, 0); - tft.print("x,y = "); - tft.print(x); - tft.print(","); - tft.println(y); - tft.print(" "); - } -} - -//------------------------------------------------------------------------------------------ - -// Code to run a screen calibration, not needed when calibration values set in setup() -void touch_calibrate() -{ - uint16_t calData[5]; - uint8_t calDataOK = 0; - - // Calibrate - tft.fillScreen(TFT_BLACK); - tft.setCursor(20, 0); - tft.setTextFont(2); - tft.setTextSize(1); - tft.setTextColor(TFT_GREEN, TFT_BLACK); - - tft.println("Touch corners as indicated"); - - tft.setTextFont(1); - tft.println(); - - tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15); - - tft.fillScreen(TFT_BLACK); - - tft.println(" //Use this calibration code in setup():"); - tft.print(" uint16_t calData[5] = { "); - - for (uint8_t i = 0; i < 5; i++) - { - tft.print(calData[i]); - if (i < 4){ - tft.print(", "); - } - - } - - tft.println(" };"); - tft.print(" tft.setTouch(calData);"); - - delay(4000); -} -