How to control LED's with Processing and Arduino

 by SammyDestruction
downsized_1016092102a.jpg
The other day I was confronted with an interesting problem, I needed to control a series of lights from an interaction on a computer screen and it had to be as inexpensive as possible.  I instantly thought of an Arduino.  It had everything that I needed, more than enough I/O, an integrated USB and its only $30.  To communicate with the Arduino I decided to use Processing.  The two work really well together because of Arduino's close family relation to Processing.
 
Remove these adsRemove these ads by Signing Up

Step 1: The Materials

Its time to gather all of the bits and pieces necessary to make this happen:

The Software:

Processing - can be found at www.processing.org
Arduino - Can be found at www.arduino.cc

The Hardware:
Arduino USB board (I used the Diecimila, because that's what I had)
8x LEDs of your choice
8x 330ohm resistors
Break away headers
single sided copper clad
Ferric Chloride
tiny drill bit
USB cable


pclever1 says: Sep 28, 2012. 6:30 PM
Hello, I am trying to use this code to control my Arduino Uno (just 8 pins, like this situation) but every time I try to upload the code i get the error:

'import' does not name a type

Do any of you know how to fix this or what I am doing wrong?

Thank you.
rk24 says: Feb 24, 2010. 4:49 PM
 I want to control the leds from internet...

can you do that?

:S please 
Coding Kid in reply to rk24Jun 13, 2010. 10:10 AM
Yes, but you would need a ethernet of wifly shield.
lsahidin in reply to Coding KidJun 8, 2012. 1:00 AM
Hi Sammy, I understand your coding :) I try to cut off your code pdxMap.pde like this:

void loop()
{
int input = Serial.read(); // read serial
if (input) { // detect input from serial
digitalWrite(Pin[input], HIGH);
delay(1000);
digitalWrite(Pin[input], LOW);
}

Nice work!! Thanks to share.
mohamed100 says: Jan 29, 2012. 2:19 PM
Thanks for this and i have a question on that :
can i controller in RC car using this method of controlling ?
lmperkins says: Jan 16, 2012. 6:34 PM
Thanks, this was really helpful. I set it up on a breadboard rather than making a custom pcb and it worked great. My first successful us of Processing.
knobcheese says: Apr 26, 2011. 6:29 AM
Thanks - worked for me :)

p.s. LEDs is the plural of LED - so no apostrophe
jman 31 says: Oct 17, 2009. 11:02 AM
Neat project. I downloaded the pdf file and when I printed it some of the traces are touching. Is there any chance you could post your Eagle files so that I could clean it up a little bit?
SammyDestruction (author) in reply to jman 31Oct 17, 2009. 12:27 PM
Thanks, I posted the Eagle schematic and board file along with the PDF.  Hopefully that helps!
jman 31 in reply to SammyDestructionOct 17, 2009. 1:37 PM
Hey man thanks for the effort, but for some reason neither the board or schematic files is working. If it's not to much trouble could you have a look at that. Thanks again!
SammyDestruction (author) in reply to jman 31Oct 17, 2009. 4:10 PM
Sorry about that, it should be working now.  good luck!
jman 31 in reply to SammyDestructionOct 17, 2009. 4:31 PM
Sorry, it must be on my end. Every time I download it it is saving it as a .tmp file. I see what you are doing so I will just recreate it in Eagle.

Thanks
Jman
SammyDestruction (author) in reply to jman 31Oct 17, 2009. 4:39 PM
Try changing the name of the file to "LED ProtoShield.brd" and "LED ProtoShield.sch" when you are saving it.
jman 31 in reply to SammyDestructionOct 24, 2009. 2:34 PM
This worked perfectly for me! I was able to get the right serial input by following your instructions and it worked great. I am just starting to learn about programmable IC's and this was a good easy learning curve.

I did have to make my own Eagle file as I was never able to upload your, and your PDF was coming out with traces touching for me. I am going to try to upload my PDF in case anyone had the same problem as me. Mine is made with the copper side down though.

http://www.italentshare.com/storage/PICs/LEDShield.pdf
frollard says: Oct 17, 2009. 2:25 AM
Nifty gizmo!

I always think that using 8 pins to control 8 leds is overkill...but so is using a shift register to use 3 pins instead of 8 :D

Great little learning chunk!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!