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.

Participated in the
Make It Glow! Contest

Participated in the
Tech Contest
13 Comments
7 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.
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!
Reply 7 years ago
swift2568,thanks for the information.And by the way,good philosophy.
7 years ago
Most welcome
7 years ago
for case 'r', plz check 2nd param of digitalWrite
Reply 7 years ago
i have checked and edited the code.
Reply 7 years ago
ramoer,i did'nt get you.can u pls put ur question in a clear way.
Reply 7 years ago
Ramoer means check the code when 'r' is typed. It should be digitalWrite(red,HIGH); instead of digitalWrite(red,OUTPUT);
Reply 7 years ago
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.
7 years ago
Great tutorial. Very well written.
Reply 7 years ago
thank u.
7 years ago
Good way to start. Very well done! Any thoughts on controlling it wirelessly?
Reply 7 years ago
thank you,thats coming up on v.2
7 years ago
Great tutorial. Very well written.