/*
  Arduino | hardware-help
  Is this wiring correct

  Tense — 1/15/2025 5:08 PM
  Im extremely new to Ardunio and im trying to work out how
  to get a working RGB LED but currently it only flashes green.
  Somone pls help or give ideas
*/

const int CA_RED_PIN =  6;  // Common Anode RGB LED pins
const int CA_GRN_PIN =  5;
const int CA_BLU_PIN =  3;
const int CC_RED_PIN = 11;  // Common Cathode RGB LED pins
const int CC_GRN_PIN = 10;
const int CC_BLU_PIN =  9;

void setColorAnode(int R, int G, int B) {
  analogWrite(CA_RED_PIN, 255 - R); // "invert" the rgb values
  analogWrite(CA_GRN_PIN, 255 - G);
  analogWrite(CA_BLU_PIN, 255 - B);
}

void setColorCathode(int R, int G, int B) {
  analogWrite(CC_RED_PIN, R);
  analogWrite(CC_GRN_PIN, G);
  analogWrite(CC_BLU_PIN, B);
}

void setup() {
  pinMode(CA_RED_PIN, OUTPUT);
  pinMode(CA_GRN_PIN, OUTPUT);
  pinMode(CA_BLU_PIN, OUTPUT);
  pinMode(CC_RED_PIN, OUTPUT);
  pinMode(CC_GRN_PIN, OUTPUT);
  pinMode(CC_BLU_PIN, OUTPUT);
}

void loop() {
  // sets both LEDs to rgb values
  setColorAnode(255, 0, 0);
  setColorCathode(255, 0, 0);
  delay(500);
  setColorAnode(0, 255, 0);
  setColorCathode(0, 255, 0);
  delay(500);
  setColorAnode(0, 0, 255);
  setColorCathode(0, 0, 255);
  delay(500);
}
$abcdeabcde151015202530fghijfghij
Common cathode RGB
Common anode RGB