Product Introduction #
RGB module is a kind of integrated red, green, blue three basic color LED (Light Emitting Diode) module, composed of red, green and blue three independent lamp beads, common has four pins, a public port and three color control ports. We can control the red, green and blue three independent lamp beads separately through the control port, so as to realize the light mixing effect and produce a variety of different color effects.
Parameter Specification #
Parameters | Value/Description |
Operating voltage | 3.3~5V |
Operating temperature | -30°C~+70°C |
Color of light | RGB three colors |
Peak wavelength | 625nm;470nm;530nm |
Control signal | Digital signal |
Size | 3.16cm*2.38cm |
Wiring Diagram #
Note:Expansion board is attached to esp32 controller board.
RGB Module | ESP32 |
GND | GND |
B | Pin 14 |
G | Pin 2 |
R | Pin 0 |
Sample Code #
//Set the RGB pin
int redpin=0;
int bluepin=14;
int greenpin=2;
int val;
void setup(){
pinMode(redpin,OUTPUT);
pinMode(bluepin,OUTPUT);
pinMode(greenpin,OUTPUT);
}
void loop()
{
for(val=255;val>0;val--){
analogWrite(redpin,val);
analogWrite(bluepin,255-val);
analogWrite(greenpin,128-val);
delay(1);
}
for(val=0;val<255;val++){
analogWrite(redpin,val);
analogWrite(bluepin,255-val);
analogWrite(greenpin,128-val);
delay(1);
}
}
Note: If you are using an Arduino board, then change the red pin in the program to PIN3, blue pin in the program to PIN4, green pin in the program to PIN5, and then connect the hardware pin to PIN3, PIN4, PIN5 and upload the program.
Test Results #
After the code is uploaded to the controller board, the RGB light will light up and the display light color will change in the order of cyan and pink.
Related Resources #
Get One Now #
B2B Business: info@acebott.com