This is an old revision of the document!


Use of RGB LEDs

This scenario presents how to handle the brightness control of the tri-coloured LEDs. Both LEDs are electrically bound and cannot be controlled independently. Those LEDs have 3 colour channels, controlled independently: R (Red), G (Green) and B (Blue). Mixing of those colours creates other ones, such as pink and violet. Each R G B channel can be controlled with a separate GPIO to switch it on or off or control brightness using a PWM signal, as presented in this tutorial.

Step 1

define the necessary pins and functions:

/* RGB LEDS */
#define RED_PIN   14
#define GREEN_PIN 15
#define BLUE_PIN  16
void setRGB(int red, int green, int blue);

Step 2

define pins as output:

void setup() {
  Serial.begin(152000);

  pinMode(RED_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  pinMode(BLUE_PIN, OUTPUT);
}

Step 3

Step 4

en/iot-open/practical/hardware/rtu/robotnest/rgb-led.1753866165.txt.gz · Last modified: 2025/07/30 09:02 by kivilands6
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0