Und hier denn nun auch mein ganzer Code, der so läuft wie ich es mir vorstelle 
(Ist nur zum Testen des TCS34725. Es wird zusätzlich ein 2,8" TFT zur Anzeige verwendet)
#include <Wire.h>
#include <Adafruit_TCS34725.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_154MS, TCS34725_GAIN_16X);
// TCS34725_INTEGRATIONTIME_2_4MS // 2.4ms - 1 cycle - Max Count: 1024
// TCS34725_INTEGRATIONTIME_24MS // 24ms - 10 cycles - Max Count: 10240
// TCS34725_INTEGRATIONTIME_50MS // 50ms - 20 cycles - Max Count: 20480
// TCS34725_INTEGRATIONTIME_101MS // 101ms - 42 cycles - Max Count: 43008
// TCS34725_INTEGRATIONTIME_154MS // 154ms - 64 cycles - Max Count: 65535
// TCS34725_INTEGRATIONTIME_700MS // 700ms - 256 cycles - Max Count: 65535
// TCS34725_GAIN_1X // No gain
// TCS34725_GAIN_4X // 4x gain
// TCS34725_GAIN_16X // 16x gain
// TCS34725_GAIN_60X // 60x gain
int mx;
int my;
int yR;
int yG;
int yB;
int yRold;
int yGold;
int yBold;
int yRmax;
int yGmax;
int yBmax;
unsigned long previousMillis = 0;
unsigned long interval = 10000;
/***********************************************************************************************************************************/
void getRawData_noDelay(uint16_t *r, uint16_t *g, uint16_t *b)
{
*r = tcs.read16(TCS34725_RDATAL);
*g = tcs.read16(TCS34725_GDATAL);
*b = tcs.read16(TCS34725_BDATAL);
}
/***********************************************************************************************************************************/
void setup() {
Serial.begin(115200);
delay (50);
tft.init();
tft.setRotation(2);
mx = tft.width();
my = tft.height();
Serial.print(mx);
Serial.print(" ");
Serial.println(my);
tft.fillScreen(TFT_BLACK);
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1);
}
// Set persistence filter to generate an interrupt for every RGB Cycle, regardless of the integration limits
tcs.write8(TCS34725_PERS, TCS34725_PERS_NONE);
tcs.setInterrupt(true);
Serial.flush();
}
/***********************************************************************************************************************************/
void loop() {
uint16_t yR, yG, yB ;
getRawData_noDelay(&yR, &yG, &yB);
yR /= 256; yG /= 256; yB /= 256;
Serial.print("R: "); Serial.print(yR, DEC); Serial.print(" ");
Serial.print("G: "); Serial.print(yG, DEC); Serial.print(" ");
Serial.print("B: "); Serial.print(yB, DEC); Serial.print(" ");
Serial.println(" ");
Serial.flush();
if (yR > yRmax) { //höchsten Rot Wert merken
yRmax = yR;
};
if (yG > yGmax) { //höchsen Grün Wert merken
yGmax = yG;
};
if (yB > yBmax) { //höchsten Blau Wert merken
yBmax = yB;
};
tft.fillRect(30, 288 - yRmax + 1 , 20, yRmax - yR - 1, TFT_BLACK);
tft.fillRect(60, 288 - yGmax + 1 , 20, yGmax - yG - 1, TFT_BLACK);
tft.fillRect(90, 288 - yBmax + 1 , 20, yBmax - yB - 1, TFT_BLACK);
tft.fillRect(30, 288 - yR , 20, yR, TFT_RED);
tft.fillRect(60, 288 - yG , 20, yG, TFT_GREEN);
tft.fillRect(90, 288 - yB , 20, yB, TFT_BLUE);
tft.drawLine(30, 288 - yRmax, 50 - 1, 288 - yRmax, TFT_WHITE);
tft.drawLine(60, 288 - yGmax, 80 - 1, 288 - yGmax, TFT_WHITE);
tft.drawLine(90, 288 - yBmax, 110 - 1, 288 - yBmax, TFT_WHITE);
tft.fillRect(120, 188, 20, 100, tft.color565(yR, yG, yB));
tft.fillRect(140, 188, 20, 100, tft.color565(yRmax, yGmax, yBmax));
if (millis() - previousMillis > interval)
{
tft.drawLine(30, 288 - yRmax, 50 - 1, 288 - yRmax, TFT_BLACK);
tft.drawLine(60, 288 - yGmax, 80 - 1, 288 - yGmax, TFT_BLACK);
tft.drawLine(90, 288 - yBmax, 110 - 1, 288 - yBmax, TFT_BLACK);
yRmax = 0;
yGmax = 0;
yBmax = 0;
previousMillis = millis();
}
}
Lieben Gruß,
Chris