RGB Module - RGB LED module is actually of two types common cathode and
common cathode and we give PWM (pulse width modulation) in order to get
different colors of different intensity. In this experiment, we will see how
we can interface or use an RGB LED module with 4 pins and will also control
it.
Apparatus Required: one RGB LED module, breadboard, several connecting wires.
Procedure:
Apparatus Required: one RGB LED module, breadboard, several connecting wires.
Procedure:
- Connect the RGB module with the breadboard.
- Connect the red wire (red color wire not mandatory) to the pin labeled 'r'.
- Now connect the green wire to the pin labeled 'g'.
- Similarly, connect the blue wire to the pin labeled 'b'.
- Let us now connect the 4th pin to the GND and with this, the connection is over.
You may also like:
- Interfacing IC 74HC595 Shift Register with Arduino Uno
- Interfacing 2 pin Flame sensor with Arduino Uno
- Interfacing 4 pin DHT 11 Temperature and Humidity Sensor
- How to use Breadboard Power Supply
- Interfacing 4 pin HC-SR04 Ultrasonic distance sensor with Arduino Uno
- Micro Servo Motor SG90 interfacing with Arduino Uno
- Interfacing 28BY-48 Stepper Motor with Arduino Uno
- How to control LED with Potentiometer(variable resistor)
- How to use Piezo buzzer (Active and Passive) with Arduino Uno
- What is Pulse Width Modulation (PWM) in Arduino?
Arduino Sketch:
int redpin = 5; // select the pin for the red LED
int bluepin =3; // select the pin for the blue LED
int greenpin =7; // select the pin for the green LED
int val;
void setup() {
pinMode(redpin, OUTPUT);
pinMode(bluepin, OUTPUT);
pinMode(greenpin, OUTPUT);
Serial.begin(9600);
}
void loop() {
for(val = 255; val > 0; val--)
{
analogWrite(5, val);
analogWrite(3, 255 - val);
analogWrite(7, 128 - val);
Serial.println(val, DEC);
delay(5);
}
for(val = 0; val < 255; val++)
{
analogWrite(5, val);
analogWrite(3, 255 - val);
analogWrite(7, 128 - val);
Serial.println(val, DEC);
delay(5);
}
}
For live demonstration visit: https://youtu.be/hj7aYin5QmM
Thank You!
0 Comments