Introduction: Arduino USB Communication - Processing Program

Since I had some problems looking for information about how to communicate the Arduino's board with the computer program, I decided to do this tutorial.

This tutorial will show you how to do a simple program (with a friendly interface - that anyone can work with), that can communicate with Arduino.

So, if you are tired of opening your "SERIAL MONITOR" in the Arduino's IDE and type all the commands, you might want to do something like this. 

At first, I was trying to make a simple program in which I could control the lights in my garden. Later on, I used this very same program to test all of my Arduino applications.



Some observations before we start:
            -- I'm not teaching how to use Arduino or Prossesing, this is just a explanation of it's capabilities.
            -- I've tried to do what I did with other languages like C, C++, delphi, etc... And turns out that the simplest way of doing what I did is using Processing. If you never used it, give it a shot... You will be surprised.
            -- Keep in mind that this is just an example program, after you get familiar with the program you can do your own stuff in order to attend your needs... Or you can just use the example program, whatever.
           -- I've used some hulk images in the program. I think Hulk is cool so I used it just for you to see how to add images in your programs. I did not do it by myself, I've got the hulk images in the internet.


Materials List
--Arduino UNO
--Two or three LED's (I used three)
--Two or three Resistors (250 ohms or similar will do the work)
--Arduino USB cable


Programs list
--Arduino's IDE  (you can download it for free in Arduino's web page)
--Processing IDE (you can download it for free in Processing's web page)
--Ms button maker ( http://www.softpedia.com/get/Internet/WEB-Design/Web-Design-related/Ms-Button-Maker.shtml)


**For futher informations about how to deal with Arduino, visit http://arduino.cc/en/

**For futher informations about how to deal with Processing, visit: http://processing.org/

You will find several tutorials, and learning stuff. You can easily learn how to work with Arduino and Processing.



Comments
I'm not giving you a huge and detailed explanation here, because I tried to do a very well commented program, you can just go to the program and everything will be there, explained (I hope).

As it is an example program, I did a general HMI (human machine interface) but you can improve it for your proposes. 

The very first thing you should know about this example is that I used the USB Port --> COM4. If you want to change it, you shall go to line 182 in the Processing program and change it.

I also used three LED attached to the pins 13, 12, 11 and an variable resistor attached to pin 0 (it is not shown in the images because I took it off. Actually you do not need it to test your program -- without it you will have a "float point" in your input and the value of the input will be oscillating).

I did not attached any diagram or draw in order to show the connections, because it is simple. If you have any problems, you can go to http://arduino.cc/en/Tutorial/HomePage, and check how to use a LED or how to use a variable resistor.

If you want to change the title of the application, go to line 504 in the Processing file, and change it by yourself. 

You need to have a folder call data in the same place as your Processing file, to keep you images and stuff.
You can also go to   --> Sketch --> add file  in the Processing IDE, and it will automatically make this folder to you.

I used the "Ms button Maker" (link above) to do the button, but you can use whatever you want, even paint.

So, get the Zip file, and study the programs, if you have an minimum of experience on Arduino, I'm sure you will get it And soon you will be able to make some progress on your own.