#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Adafruit_ILI9341.h>
#include <Wire.h>
#include <Adafruit_FT6206.h>
// Initialize touchscreen and display
Adafruit_FT6206 ctp = Adafruit_FT6206();
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup(void) {
// Start serial communication for debugging
Serial.begin(115200);
// Initialize the TFT display
tft.begin();
tft.fillScreen(ILI9341_BLACK); // Clear the screen with black color
// Initialize the touchscreen
if (!ctp.begin(40)) { // Adjust sensitivity as needed
Serial.println("Couldn't start FT6206 touchscreen controller");
while (1); // Halt execution if touchscreen initialization fails
}
Serial.println("Touchscreen initialized");
}
void loop() {
// Main loop code here
}