Introduction: Laptop Controlled Rgb Led V.1

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.

Comments

author
Swift2568 (author)2015-12-29

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.

http://makezine.com/projects/make-32/the-awesome-b...

https://www.pjrc.com/teensy/tutorial2.html
https://www.pjrc.com/teensy/tutorial3.html


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.
http://highlowtech.org/?p=1695
https://www.sparkfun.com/products/11801
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!

author
Manoj SuryaK (author)Swift25682015-12-29

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

author
pj200 (author)2015-12-14

Most welcome

author
ramoer (author)2015-12-12

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

author
Manoj SuryaK (author)ramoer2015-12-13

i have checked and edited the code.

author
Manoj SuryaK (author)ramoer2015-12-12

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

author
pj200 (author)Manoj SuryaK2015-12-13

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

author
Manoj SuryaK (author)pj2002015-12-13

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.

author
DIY Hacks and How Tos (author)2015-12-12

Great tutorial. Very well written.

author

thank u.

author
Saiyam (author)2015-12-12

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

author
Manoj SuryaK (author)Saiyam2015-12-12

thank you,thats coming up on v.2

author
DIY Hacks and How Tos (author)2015-12-12

Great tutorial. Very well written.

About This Instructable

2,891views

38favorites

License:

Bio: electrifying guy
More by Manoj SuryaK:DIY - IoT Pet FeederPaper,pencil,a touchsensing glove and an wireless robot!!laptop controlled rgb led v.1
Add instructable to: