Light Indicator
I thought about an idea where I can use a sensor along with an RGB to represent some value. I first got to know the sensors available in the kit and I decided to use the light sensor, and output different colors depending on the surrounding light intensity.
TinkerCAD
I used AutoDesk TinkerCAD to design my circuit and also to simulate it before making it in real life.
Electronics Kit
I used some components from my electronics kit (RGB LED, light sensor module, Jumpers, Breadboard, and Arduino UNO).
Circuit Simulation
I searched for the right connections of the RGB and the light sensor. I then placed all the necessary components on the breadboard and connected them to the Arduino UNO board as follows:
VCC and GND from the sensor to 5V and GND.
DATA pin from the sensor to digital pin 4.
After that, I started building the code blocks.
I wanted the LED to produce a different color for different lights, so the conditions were as follows:
If the light is on, the blue led is on.
If the light is off, the green led is on.
I used the same connections from TinkerCAD to make the circuit in the real life.
I wrote the Arduino code and I made sure everything was right by clicking "Verify", then uploaded it to the Arduino board.
At first, I had different colors than those I used in the condition. I searched and found that the pin numbers are not written randomly. They have to be arranged as R, G, and B to show the right color.