Color sensor RGB

it takes 2 seconds in the following moment:
I have my sensor connected and working = thus the value of the color red becomes a midi cc value in the code, and that midi cc is then going into my pure data music program, where i can see the incoming cc value.
Now i put something red onto the sensor. In my Serial monitor in arduino i instantly see the value of red rising higher. But it takes around two seconds until i see that same rise of value in pure data. Maybe one could call that a kind of midi latency?
I didn't have that problem in Pure data with the light sensor project i mentioned earlier.

I solved my 2-Second Problem!
I still had some Serial.print messages in my code, which i deleted. They slowed everything down.

Also i wrote an if-argument, in which i compared the old value of the sensor with the new value. Only if that value changes, it triggers a new midi message.

My only problem now is still that i still only feed the sensor with the value of one color. I don't get it how i make three cc messages out of the value r g b.
I am still trying to get my head around what you wrote, J-M-L Jackson, that i should send different events with the midiEventPacket_t. Maybe you can point me in the direction?

Here is my code right now:

#include <Wire.h>
#include "Adafruit_TCS34725.h"
#include "MIDIUSB.h"
//Adafruit_TCS34725 tcs = Adafruit_TCS34725();
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X);
uint8_t valueR = 0;
uint8_t valueG = 0;
uint8_t valueB = 0;
uint8_t GAlt = 0;

const byte TOTAL_BUTTONS = 16;
// All the Arduino pins used for buttons, in order.
const byte BUTTONS_PIN[TOTAL_BUTTONS] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, A0, A1, A2, A3, A4};
// Every pitch corresponding to every Arduino pin. Each note has an associated numeric pitch (frequency scale).
// See https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h
const byte BUTTONS_PITCH[TOTAL_BUTTONS] = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
// Current state of the pressed buttons.
byte currentRead[TOTAL_BUTTONS];
// Temporary input reads to check against current state.
byte tempRead;

// The setup function runs once when you press reset or power the board
void setup() {
  for (byte i = 0; i < TOTAL_BUTTONS; i++) {
    pinMode(BUTTONS_PIN[i], INPUT_PULLUP);

  }

  Serial.begin(9600);

  if (tcs.begin()) {
    Serial.println("Found sensor");
  } else {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);
  }
  // Initialize all the pins as a pull-up input.

}
// Now we're ready to get readings!


// The loop function runs over and over again forever
void loop() {
  sensor();
  button();
}

void sensor() {
  uint16_t r, g, b, c, colorTemp, lux;

  tcs.getRawData(&r, &g, &b, &c);
  colorTemp = tcs.calculateColorTemperature(r, g, b);
  lux = tcs.calculateLux(r, g, b);
  //Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
  //Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
  //Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
  //Serial.println(" ");

  // const int numberOfSensors = 2; Brauch ist das später?
  uint8_t  valueG = g >> 5;
  if (valueG != GAlt) {
    //Serial.print("valueR: "); Serial.print(valueR, DEC); Serial.print(" ");
    //Serial.print("valueG: "); Serial.print(valueG, DEC); Serial.print(" ");
    //Serial.print("valueB: "); Serial.print(valueB, DEC); Serial.print(" ");
    //Serial.println(" ");

    midiEventPacket_t midiCc = { 0x0B, 0xB0, 1, valueG };
    MidiUSB.sendMIDI(midiCc);
    MidiUSB.flush();
    GAlt = valueG;
  }
}


void button() {
  for (byte i = 0; i < TOTAL_BUTTONS; i++) {
    // Get the digital state from the button pin.
    // In pull-up inputs the button logic is inverted (HIGH is not pressed, LOW is pressed).
    byte buttonState = digitalRead(BUTTONS_PIN[i]);
    // Temporarily store the digital state.
    tempRead = buttonState;
    // Continue only if the last state is different to the current state.
    if (currentRead[i] != tempRead) {
      // See https://www.arduino.cc/en/pmwiki.php?n=Tutorial/Debounce
      delay(1);
      // Get the pitch mapped to the pressed button.
      byte pitch = BUTTONS_PITCH[i];
      // Save the new input state.
      currentRead[i] = tempRead;
      // Execute note on or noted off depending on the button state.
      if (buttonState == LOW) {
        noteOn(pitch);
      } else {
        noteOff(pitch);
      }
    }
  }
}

void noteOn(byte pitch) {
  MidiUSB.sendMIDI({0x09, 0x90, pitch, 127});
  MidiUSB.flush();
}

void noteOff(byte pitch) {
  MidiUSB.sendMIDI({0x08, 0x80, pitch, 0});
  MidiUSB.flush();
}

Thank you all!

If you repeat this for R and B as well, you're there, aren't you? I'm not sure I understand your problem...?