Jump to content
Arduino.lk Community Sri Lanka
  • Announcements

    • Team Arduino.lk

      Arduino Stater Kit 2 එකක් දිනාගන්න.   11/13/2017

      arduino.lk community වෙත ඔබව සාදරයෙන් පිළිගනිමු. ඔබගේ ගැටළු අදහස් මෙහි පළකර Rs 3650.00 වටිනා Arduino Stater Kit 2 එකක් දිනාගන්න. ඔබ කල යුත්තේ Arduino, හා සම්බන්ධ අදහස්, ලිපි, කමෙන්ට් මෙහි පල කර මෙහි ඇති LeaderBoard එකේ පළමු තැනට පැමිණීමයි. සැම මාසකම අවසාන දින 11.55 PM හොදම Contributor තෝරනු ලැබේ
Sign in to follow this  
Team Arduino.lk

KY-016 RGB FULL COLOR LED MODULE

Recommended Posts

Description

KY-016 Arduino full color 5mm RGB LED, different colors can be obtained by mixing the three primary colors

KY-016_Keyes_RGB_full_color_LED_module-2Specifications

This module consists of a 5mm RGB LED and three 150Ω limiting resistors to prevent burnout. Adjusting the PWM signal on each color pin will result on different colors.

 
Operating Voltage 5V
LED drive mode Common cathode driver
LED diameter 5 mm

KY-016 Connection Diagram

Connect the red pin (R) on the KY-016 to pin 11 on the Arduino. Blue (B) to pin 10, green (G) to pin 9 and ground (-) to GND. Notice that you do not need to use limiting resistors since they are already included on the board.

Arduino_KY-016_Keyes_RGB_full_color_LED_

 
KY-016 Arduino
R Pin 11
B Pin 10
G Pin 9
GND

KY-016 Example Code

The following Arduino sketch will gradually increase/decrease the PWM values on the red, green and blue pins causing the LED to cycle through various colors.

int redpin = 11; // select the pin for the red LED
int bluepin =10; // select the pin for the  blue LED
int greenpin =9; // 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(11, val);
    analogWrite(10, 255 - val);
    analogWrite(9, 128 - val);

    Serial.println(val, DEC);
    delay(5); 
  }
  for(val = 0; val < 255; val++)
  {
    analogWrite(11, val);
    analogWrite(10, 255 - val);
    analogWrite(9, 128 - val);
    
    Serial.println(val, DEC);
    delay(5); 
  }
}

 

View the full article

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×