#include <Wire.h> // Für die Verkabelung (denke ich)
#include <Adafruit_GFX.h> // Für die Grafiken
#include <SPI.h> // das wird gebraucht fürs Display
#include <Adafruit_ILI9341.h> // Für das Display
#include <Adafruit_FT6206.h> // Für den Touchscreen
#include <Arduino.h> // das wird gebraucht für FT6206
// The FT6206 uses hardware I2C (SCL/SDA)
Adafruit_FT6206 = Adafruit_FT6206();
#define TFT_CS 15
#define TFT_RST 4
#define TFT_DC 2
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// Status der Rechtecke
bool Mitte_Rot = true;
bool Mitte_Blau = false;
bool Mitte_Gruen = false;
void setup() {
Serial.begin(115200);
if (! ctp.begin(40)) { // pass in 'sensitivity' coefficient
Serial.println("Couldn't start FT6206 touchscreen controller");
while (1);
} else() {Serial.println("Capacitive touchscreen started");}
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
tft.fillRect(uint16_t 20, uint16_t 70, uint16_t 80, uint16_t 100, uint16_t ILI9341_BLUE);
tft.fillRect(uint16_t 120, uint16_t 70, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.fillRect(uint16_t 220, uint16_t 70, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
Mitte_Rot = true;
}
void loop(){
/*
while(Mitte_Rot == true){
if (! ctp.touched()) {
return;
}
TS_Point p = ctp.getPoint();
if((p.y > 70) && (p.y <= 170)){
if(Linkes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_BLUE);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.display();
Mitte_Rot = false;
Mitte_Blau = true;
}
if(Rechtes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_Blue);
tft.display();
Mitte_Rot = false;
Mitte_Gruen = true;
}
}
while(Mitte_Blau == true){
if(Linkes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_Blue);
tft.display();
Mitte_Blau = false;
Mitte_Gruen = true;
}
if(Rechtes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_BLUE);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.display();
Mitte_Blau = false;
Mitte_Rot = true;
}
}
while(Mitte_Gruen == true){
if(Linkes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_BLUE);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.display();
Mitte_Gruen = false;
Mitte_Rot = true;
}
if(Rechtes_Rechteck == touched){
tft.clearDisplay();
tft.fillRect(uint16_t 20, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_GREEN);
tft.fillRect(uint16_t 120, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_BLUE);
tft.fillRect(uint16_t 220, uint16_t 100, uint16_t 80, uint16_t 100, uint16_t ILI9341_RED);
tft.display();
Mitte_Gruen = false;
Mitte_Blau = true;
}
}
*/
}