An RGB LED is essentially made up of three LEDs—red, green, and blue—captured within a single transparent or diffuse epoxy lens. Each internal LED chip emits light at a specific wavelength corresponding to its color: red typically around 620–630 nm, green around 520–530 nm, and blue around 460–470 nm. These chips are carefully positioned next to each other to ensure their light blends smoothly, allowing the human eye to perceive a combined color rather than three separate colors. This compact integration enables RGB LEDs to produce millions of hues through variable intensity control of the three channels.
Structurally, an RGB LED package includes four wires or pins extending from the base. Three of these pins correspond to the color channels: R (red), G (green), and B (blue), while the fourth serves as a common terminal shared between the three LEDs. The common terminal can be connected to either the positive supply voltage or ground, depending on the type of RGB LED.
Structurally, an RGB LED package includes four wires or pins extending from the base. Three of these pins correspond to the color channels: R (red), G (green), and B (blue), while the fourth serves as a common terminal shared between the three LEDs. The common terminal can be connected to either the positive supply voltage or ground, depending on the type of RGB LED.
RGB_LED.B4R:
'LGB_LED - Diode à couleurs changeantes
' With Arduino UNO Board
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public Serial1 As Serial
Private RedLED, GreenLED, BlueLED As Pin
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("Start")
RedLED.Initialize(11, RedLED.MODE_OUTPUT)
GreenLED.Initialize(10, GreenLED.MODE_OUTPUT)
BlueLED.Initialize(9,BlueLED.MODE_OUTPUT)
Start
End Sub
Sub Start
For i = 1 To 3
' Red Color (full red, no green, no blue)
RedLED.AnalogWrite(255)
GreenLED.AnalogWrite(0)
BlueLED.AnalogWrite(0)
Delay(2000)
' Green Color (no red, full green, no blue)
RedLED.AnalogWrite(0)
GreenLED.AnalogWrite(255)
BlueLED.AnalogWrite(0)
Delay(2000)
' Blue Color (no red, no green, full blue)
RedLED.AnalogWrite(0)
GreenLED.AnalogWrite(0)
BlueLED.AnalogWrite(255)
Delay(2000)
' Cyan
RedLED.AnalogWrite(0)
GreenLED.AnalogWrite(255)
BlueLED.AnalogWrite(255)
Delay(2000)
' Yellow
RedLED.AnalogWrite(255)
GreenLED.AnalogWrite(255)
BlueLED.AnalogWrite(0)
Delay(2000)
' Violet
RedLED.AnalogWrite(128)
GreenLED.AnalogWrite(0)
BlueLED.AnalogWrite(128)
Delay(2000)
Next
RedLED.DigitalWrite(False)
GreenLED.DigitalWrite(False)
BlueLED.DigitalWrite(False)
End Sub