Project 1.5.1: RED-G-B
| Description | This project teaches how to connect and program an RGB LED so that only the red light turns on using an Arduino. |
|---|---|
| Use case | This can be used as a warning or alert system, where the red light turns on to indicate danger, an error, or restricted access. |
Components (Things You will need)
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|
Building the circuit
Things Needed:
- Arduino Uno Board = 1
- Arduino USB cable = 1
- RGB= 1
- Red jumper wires = 1
- White jumper wires = 1
Mounting the component on the breadboard
Step 1: Insert the RGB module into the middle section of the breadboard horizontally. Make sure you identify the R pin (Red) and the – pin (GND).
NB: Take note of where each of the pins of the RGB are placed on the bread board.
.
WIRING THE CIRCUIT
Things Needed:
- Red jumper wire = 1
- white jumper wire = 1
Step 2: Connect the red jumper wire from the R pin of the RGB module to pin 5 on the Arduino UNO. Then connect the white jumper wire from the – (GND) pin of the RGB module to the GND pin on the Arduino UNO.
.
PROGRAMMING
Step 1: Open your Arduino IDE. See how to set up here: Getting Started.
Step 2: Type const int red = 5; as shown below in the image.
NB: Make sure you avoid errors when typing. Do not omit any character or symbol especially the bracket { } and semicolons ; and put them as you see in the image. The code that comes after the two ash backslashes “//” are called comments. They are not part of the code that will be run, they only explain the lines of code. You can avoid typing them.
.
Step 3: Type pinMode (red, OUTPUT); as shown below in the image.
.
NB: The code below sets the pin names “red” as an output pin. An output pin helps send signals from the microcontroller to other components in the circuit. The pinMode () function, helps determine and control the behavior of a specific pin on the board
Step 4: Type digitalWrite (red, HIGH); as shown below in the image.
.
The digitalWrite () function controls the state of the pin. The pin can either be HIGH or LOW. The HIGH state turns on the LED. As a result, the code below turns on the LED.
NB: To turn off the red light,
Step 5: Type digitalWrite (red, LOW); as shown below in the image.
.
NB: The LOW state turns off the LED. Hence, you can include the code below in your main code if you want to turn your light off but you are not required to do so.
Step 6: Save your code. See the Getting Started section
Step 7: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.
Step 8: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code
CONCLUSION
This project demonstrated how to control only the red light in an RGB module using an Arduino UNO. It helped in understanding basic circuit connections, color control, and simple LED programming, which can be applied in lighting and electronic projects.





