The problem is that the RGB is a Common Anode type so the common is wired to +5V and you light the LED by setting the pin LOW. Power then flows from the+5V pin through the LED to the control pin.
To fix the problem we have to invert the signal for those three pins. To do that we add another array that gives the OnValue for each of the pins (LOW or HIGH). We can turn the LED on by setting the pin to OnValue and turn it off by setting it to the logical inverse of that value: !OnValue.
// blink in order: RGB Red, RGB Green, RGB Blue, LED 5, LED 6, LED A2, LED A4, LED A3.
const byte Pins[] = {9, 11, 10, 5, 6, A2, A4, A3};
const byte Count = sizeof Pins / sizeof Pins[0]; // Calculate the number of elements in an array
// Now that we have calculated the number of pins we specify that as the size of the other array(s).
// This allows the compiler to warn us if we put in the wrong number of initializers.
const boolean OnValue[Count] = {LOW, LOW, LOW, HIGH, HIGH, HIGH, HIGH, HIGH};
void setup() {
// Set initial state and pin mode
for (int i=0; i<Count; i++) {
digitalWrite(Pins[i], !OnValue[i]);
pinMode(Pins[i], OUTPUT);
}
delay(1000);
// Blink in sequence
for (int i=0; i<Count; i++) {
digitalWrite(Pins[i], OnValue[i]);
delay(200);
digitalWrite(Pins[i], !OnValue[i]);
delay(200); // Optional if you want off time between LEDs
}
}
void loop() {}