Arduino Nano R4 - RGB LED

Could this be a simple case of inverted logic on the RGB LED? (common anode rather than common cathode) 0,0,0 being white? The following sketch results in the color “red” on the onboard RGB LED:

void setup() {
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
}

void loop() {
  analogWrite(LEDR, 0);
  analogWrite(LEDG, 255);
  analogWrite(LEDB, 255);
  delay(1000);
}

NOTE: for the nano r4 pin mappings (link)

Yes, the onboard LED is C.A. - so the elements light when the output is LOW.

You can turn that around in software.

1 Like

Agreed…

void setColorRGB(int red, int green, int blue){
  analogWrite(LEDR, (255 - red));
  analogWrite(LEDG, (255 - green));
  analogWrite(LEDB, (255 - blue));
}

What do you mean by C.A.?

Common Anode

CC is Common Cathode.

Just depends on the internal wiring of of the chip.

Often seen in things like 7-segment LED displays. Just means all the 7 or 8 individual LEDs have their anodes or cathodes connected together.

1 Like

Well, yeah, I’m not used to the abbreviations, thanks for that

You can see the LED connection in the schematic.
https://docs.arduino.cc/resources/schematics/ABX00142-schematics.pdf

Plenty more where they come from.
It's just shorthand.
In a technical document, it's good practice to add a section called abbreviations used, or explain at source, i.e. Common Anode (CA), or vice versa.
However, it's often assumed that the reader already knows.
No harm in asking though.

I already know the terminology of C.A., I just didn’t know the shorthand version