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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.


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.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 =; //read the byte


switch(incomingByte) //control for various cases


case 'r': //if r is typed

digitalWrite(red,HIGH); //red glows



case 'g': //if g is typed

digitalWrite(green,HIGH); //green glows



case 'b': //if b is typed

digitalWrite(blue,HIGH);// blue glows



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

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    13 Discussions


    3 years ago

    Looks great, but you can probably do this cheaper and on a smaller footprint with a Teensy. Teensys are the size of a coin, and have usb serial communication built in.

    I would have tried to do it with an ATtiny85 and a Neopixel. $1.25 for an Arduino compatible chip. The neopixel is a single pin 3 color led using a special library.
    I use ATtiny85s for all of my projects. My philosophy is why pay for a full Arduino board when all you need is a couple IO pins.

    I hope my notes can help you. Great read!

    1 reply

    Reply 3 years ago

    swift2568,thanks for the information.And by the way,good philosophy.


    3 years ago

    for case 'r', plz check 2nd param of digitalWrite

    4 replies

    Reply 3 years ago

    ramoer,i did'nt get you.can u pls put ur question in a clear way.

    Ramoer means check the code when 'r' is typed. It should be digitalWrite(red,HIGH); instead of digitalWrite(red,OUTPUT);

    oh ya pj200,i guess the problem has occured when i tried to copy and paste the code instead of typing it.ty for notifying me.


    3 years ago

    Good way to start. Very well done! Any thoughts on controlling it wirelessly?

    1 reply