loading

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.

<p>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.</p><p><a href="http://makezine.com/projects/make-32/the-awesome-button/" rel="nofollow">http://makezine.com/projects/make-32/the-awesome-b...</a></p><p><a href="https://www.pjrc.com/teensy/tutorial2.html" rel="nofollow">https://www.pjrc.com/teensy/tutorial2.html</a><br><a href="https://www.pjrc.com/teensy/tutorial3.html" rel="nofollow">https://www.pjrc.com/teensy/tutorial3.html</a><br><br><br>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. <br><a href="http://highlowtech.org/?p=1695" rel="nofollow">http://highlowtech.org/?p=1695</a><br><a href="https://www.sparkfun.com/products/11801" rel="nofollow">https://www.sparkfun.com/products/11801</a><br>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.<br><br>I hope my notes can help you. Great read!</p>
<p>swift2568,thanks for the information.And by the way,good philosophy.</p>
Most welcome
for case 'r', plz check 2nd param of digitalWrite
<p>i have checked and edited the code.</p>
<p>ramoer,i did'nt get you.can u pls put ur question in a clear way.</p>
<p>Ramoer means check the code when 'r' is typed. It should be digitalWrite(red,HIGH); instead of digitalWrite(red,OUTPUT);</p>
<p>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.</p>
<p>Great tutorial. Very well written.</p>
<p>thank u.</p>
Good way to start. Very well done! Any thoughts on controlling it wirelessly?
<p>thank you,thats coming up on v.2</p>
<p>Great tutorial. Very well written.</p>

About This Instructable

2,878views

38favorites

License:

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