Runs your sketch
Arduino
Brain
combining channel values for colors
Mix RGB channels to make yellow, cyan, magenta, and white.

Pin connections
| Part 1 | Part 2 | |
|---|---|---|
Arduino pin 9 | → | Red resistor pin 1 |
Red resistor pin 2 | → | RGB LED red (R) |
Arduino pin 10 | → | Green resistor pin 1 |
Green resistor pin 2 | → | RGB LED green (G) |
Arduino pin 11 | → | Blue resistor pin 1 |
Blue resistor pin 2 | → | RGB LED blue (B) |
RGB LED common (COM) | → | Arduino GND |
Mix channels to make new colors!
Turn two or three channels ON together — yellow, cyan, white, and more.
Screens mix red, green, and blue to paint every color.
The problem
Single channels give basic colors — combinations make more.
Think of it like
Like mixing paint — red plus green makes yellow.
Runs your sketch
Arduino
Brain
Three color channels in one bulb
RGB LED
Color light
Protects the red channel
Red resistor
Safety
Protects the green channel
Green resistor
Safety
Protects the blue channel
Blue resistor
Safety
Pure red
Only the red channel is on.
setChannels(HIGH, LOW, LOW);
Yellow mix
Red and green together look yellow — two channels ON at once.
setChannels(HIGH, HIGH, LOW);
Pure green
Just green this time.
setChannels(LOW, HIGH, LOW);
Cyan mix
Green plus blue makes cyan.
setChannels(LOW, HIGH, HIGH);
Pure blue
Blue alone.
setChannels(LOW, LOW, HIGH);
Magenta mix
Red plus blue makes magenta.
setChannels(HIGH, LOW, HIGH);
White — all on
All three channels together look white, then loop() repeats.
setChannels(HIGH, HIGH, HIGH);
Then loop back to step 1
Follow these steps in order. Match the wires to the colors shown.
Place Arduino
Place the Arduino (uno) on the breadboard.
Arduino placed!
Place RGB LED
Place the RGB LED (rgb1) on the breadboard.
Place Red resistor
Place the Red resistor (rr) on the breadboard.
Place Green resistor
Place the Green resistor (rg) on the breadboard.
Place Blue resistor
Place the Blue resistor (rb) on the breadboard.
Connect Arduino pin 9 to Red resistor (rr) 1
Connect Arduino pin 9 to Red resistor (rr) 1.
Connect Red resistor (rr) 2 to RGB LED (rgb1) R
Connect Red resistor (rr) 2 to RGB LED (rgb1) R.
Connect Arduino pin 10 to Green resistor (rg) 1
Connect Arduino pin 10 to Green resistor (rg) 1.
Connect Green resistor (rg) 2 to RGB LED (rgb1) G
Connect Green resistor (rg) 2 to RGB LED (rgb1) G.
Connect Arduino pin 11 to Blue resistor (rb) 1
Connect Arduino pin 11 to Blue resistor (rb) 1.
Connect Blue resistor (rb) 2 to RGB LED (rgb1) B
Connect Blue resistor (rb) 2 to RGB LED (rgb1) B.
Connect RGB LED (rgb1) COM to Arduino GND
Connect RGB LED (rgb1) COM to Arduino GND.
setChannels()
void setChannels(int r, int g, int b) {
digitalWrite(PIN_R, r);
digitalWrite(PIN_G, g);
digitalWrite(PIN_B, b);
}One function sets all three pins at once — easier than three separate digitalWrite lines each time.
Setup RGB pins
void setup() {
pinMode(PIN_R, OUTPUT);
pinMode(PIN_G, OUTPUT);
pinMode(PIN_B, OUTPUT);
}All three color pins are configured as outputs in setup().
Color mixing loop
void loop() {
setChannels(HIGH, LOW, LOW);
delay(600);
setChannels(HIGH, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, HIGH);
delay(600);
setChannels(LOW, LOW, HIGH);
delay(600);
setChannels(HIGH, LOW, HIGH);
delay(600);
setChannels(HIGH, HIGH, HIGH);
delay(600);
}Each setChannels call is a different recipe. Combining channels is how new colors appear.
const int PIN_R = 9;
const int PIN_G = 10;
const int PIN_B = 11;
void setChannels(int r, int g, int b) {
digitalWrite(PIN_R, r);
digitalWrite(PIN_G, g);
digitalWrite(PIN_B, b);
}
void setup() {
pinMode(PIN_R, OUTPUT);
pinMode(PIN_G, OUTPUT);
pinMode(PIN_B, OUTPUT);
}
void loop() {
setChannels(HIGH, LOW, LOW);
delay(600);
setChannels(HIGH, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, HIGH);
delay(600);
setChannels(LOW, LOW, HIGH);
delay(600);
setChannels(HIGH, LOW, HIGH);
delay(600);
setChannels(HIGH, HIGH, HIGH);
delay(600);
}
Q1. Where does repeating work belong?
Q2. Which channels are ON to make yellow?
Cycle colors faster — change delay(600) to delay(300) throughout loop().
Hint: Many delay lines share the same number.
Add a comment on the yellow setChannels(HIGH, HIGH, LOW) line.
Hint: It is the second setChannels call in loop().
A line-by-line tour of the sketch — the same steps as in Robo Gurukul Studio.
Program overview
Technical
Sketches have globals, then setup() once, then loop() forever.
In this project
Mix RGB channels to make yellow, cyan, magenta, and white.
Why here
Read from top to bottom. Hover words or lines for help!
const int PIN_R = 9;
const int PIN_G = 10;
const int PIN_B = 11;
void setChannels(int r, int g, int b) {
digitalWrite(PIN_R, r);
digitalWrite(PIN_G, g);
digitalWrite(PIN_B, b);
}setup()
Technical
Runs one time when the board turns on.
In this project
Sets up pins and libraries for RGB Color Mixer.
Why here
One-time setup belongs here—not in loop().
void setup() {
pinMode(PIN_R, OUTPUT);
pinMode(PIN_G, OUTPUT);
pinMode(PIN_B, OUTPUT);
}loop()
Technical
Runs again and again after setup() is done.
In this project
This is the main action you see in RGB Color Mixer.
Why here
Repeating work (blink, read sensors) goes here.
void loop() {
setChannels(HIGH, LOW, LOW);
delay(600);
setChannels(HIGH, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, LOW);
delay(600);
setChannels(LOW, HIGH, HIGH);
delay(600);
setChannels(LOW, LOW, HIGH);
delay(600);
setChannels(HIGH, LOW, HIGH);
delay(600);
setChannels(HIGH, HIGH, HIGH);
delay(600);
}
Try this: Change numbers in loop(), then compile and run the simulator.
pinMode
Technical
Tells a pin if it listens or drives something.
In this project
Gets the RGB Color Mixer circuit ready in the simulator.
Why here
Goes in setup() because we only set pins once at the start.
pinMode(PIN_R, OUTPUT);
digitalWrite
Technical
Turns a pin ON or OFF.
In this project
Controls lights, motors, or buzzers in RGB Color Mixer.
Why here
Goes in loop() so it can keep changing while the program runs.
digitalWrite(PIN_R, r);
delay
Technical
Waits for some time. Nothing else runs during the wait.
In this project
Controls speed so you can see RGB Color Mixer in the simulator.
Why here
Right after an action that should stay the same for a moment.
delay(600);