Introduction: Laptop Controlled Rgb Led V.1

About: electrifying guy

hello tech buddies,i have been into project making hobby since i was a kid.the instructables site has catalysed this hobby and i am very greatful to all the publishers.

This is my 1st one,and i request you to do the two things:-

1)support me

2)pardon my mistakes

coming to the instructable,i'll show u how to control a rgb led via laptop.

Step 1: Materials Required

1) an arduino board(uno r3 in my case)

2) common cathode rgb module(if u dont have a module, u can do it with the rgb led with 220 ohm resirtors connected to ur common cathode rgb led)

3) connecting cable

4)jumper wires

4)and ur laptop.

Step 2: Ahh... Procedure

as the name suggests these leds can give out red/green/blue lights.

our intention is to make the led to give out color for respective alphabets entered in our laptop keyboard.

r --> red

g -->green

b -->blue.

connections:-

connect ground terminal of led to ground of arduino

connect red terminal to digital pin 5 of arduino

connect green terminal to digital pin 6 of arduino

connect blue terminal to digital pin 7 of arduino

Step 3: Code

copy and paste this code on ur arduino sketch:

//coded by manoj surya k
//there is always room upon improving the code

const int red = 5; //declaring led pin

const int green = 6;//declaring led pin const

int blue = 7;//declaring led pin

int incomingByte = 0;//declararing incomingbyte variable and initializing it to zero

void setup() { // put your setup code here, to run once:

Serial.begin(9600);

Serial.println("press r for red color,g for green color and b for blue color");

pinMode(red,OUTPUT);//declaring output

pinMode(green,OUTPUT);//declaring output

pinMode(blue,OUTPUT);//declaring output

}

void loop() { // put your main code here, to run repeatedly:

if (Serial.available() > 0) { //check for byte

incomingByte = Serial.read(); //read the byte

}

switch(incomingByte) //control for various cases

{

case 'r': //if r is typed

digitalWrite(red,HIGH); //red glows

incomingByte='*';

break;

case 'g': //if g is typed

digitalWrite(green,HIGH); //green glows

incomingByte='*';

break;

case 'b': //if b is typed

digitalWrite(blue,HIGH);// blue glows

incomingByte='*';

break;

delay(100); //wait for 100ms

}

}

Then go to the serial monitor and control ur led.

thank you,support me and many more comin up.

Tech Contest

Participated in the
Tech Contest

Make It Glow! Contest

Participated in the
Make It Glow! Contest