The KY-016 RGB LED module by AZDelivery is a versatile electronic component capable of emitting light in red, green, and blue. It is a compact module that integrates a 5mm RGB LED and a set of current-limiting resistors, making it suitable for direct use with microcontroller boards such as the Arduino UNO. The module's ability to blend different intensities of each primary color allows it to produce a wide spectrum of colors, making it ideal for a variety of applications including mood lighting, color-based indicators, and interactive projects.
Pin Number | Description | Notes |
---|---|---|
1 | Red (R) | Anode (+) for the red LED |
2 | Ground (GND) | Common cathode (-) |
3 | Green (G) | Anode (+) for the green LED |
4 | Blue (B) | Anode (+) for the blue LED |
// Define the RGB LED pins
const int RED_PIN = 9; // Red LED connected to digital pin 9
const int GREEN_PIN = 10; // Green LED connected to digital pin 10
const int BLUE_PIN = 11; // Blue LED connected to digital pin 11
void setup() {
// Set the LED pins as outputs
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
}
void loop() {
// Set the color to purple (red + blue)
analogWrite(RED_PIN, 255); // Red at full intensity
analogWrite(GREEN_PIN, 0); // Green off
analogWrite(BLUE_PIN, 255); // Blue at full intensity
delay(1000); // Wait for 1 second
// Set the color to aqua (green + blue)
analogWrite(RED_PIN, 0); // Red off
analogWrite(GREEN_PIN, 255); // Green at full intensity
analogWrite(BLUE_PIN, 255); // Blue at full intensity
delay(1000); // Wait for 1 second
}
Q: Can I connect the RGB LED module directly to an Arduino without resistors?
A: No, you should always use current-limiting resistors to prevent damage to the LED and the Arduino pins.
Q: How do I create white light with the RGB LED module?
A: To create white light, you need to turn on all three colors (red, green, and blue) at full intensity. Adjust the PWM values to fine-tune the shade of white.
Q: Can I use this module with a 3.3V microcontroller?
A: Yes, but the brightness will be lower. You may need to adjust the resistor values accordingly.