It is very exciting for me to interface a circuit with a program.
Last night I made the following example which comes with the libraries I used.
[youtube=http://youtu.be/Lhvz8fVcN40&rel=0&vq=hd720 ]
So this is how you can do it:
1. Download the Processing IDE from processing.org (I suggest to use the stable version 1.5.1 )
2. Download the processing library for arduino: processing-arduino.zip
(properties file here: processing-arduino.txt)
3. Unzip the library and copy the “arduino” folder into the “libraries” sub-folder of your Processing Sketchbook. (You can find the location of your Sketchbook by opening the Processing Preferences. If you haven’t made a “libraries” sub-folder, create one.)
4.Run Arduino, open the Examples > Firmata > StandardFirmata sketch, and upload it to the Arduino board. Now you can close the Arduino IDE.
5. In Processing, open one of the examples that comes with with the Arduino library.
6.Edit the example code to select the correct serial port. So you have the following code in the beginning:
On the 12th line you have Serial.list()[0] where you might change the [0] according to which port you are using with your arduino(I’m using [4]). Here is the list:
[0] “/dev/tty.Bluetooth-PDA-Sync”
[1] “/dev/cu.Bluetooth-PDA-Sync”
[2] “/dev/tty.Bluetooth-Modem”
[3] “/dev/cu.Bluetooth-Modem”
[4] “/dev/tty.usbmodemfd111”
[5] “/dev/cu.usbmodemfd111”
7.Run the example.
You might get following error:
The you should solve the problem following these steps:
1. Download the latest RXTX library from http://rxtx.qbang.org/
2. Find the files librxtxSerial.jnilib and RXTXcomm.jar in the unzipped folder structure: MACOSX_IDE/ForPackageMaker/Install/Java/Extensions
4. Close down Processing and right-click on the application in the “Applications”-folder and select “Show Package Contents”. Go to folder “Contents/Resources/Java/modes/java/libraries/serial/library”. Replace the old RXTXcomm.jar with the new file in this folder.
5. Replace the file librxtxSerial.jnilib with the new file in the “macosx” folder “Contents/Resources/Java/modes/java/libraries/serial/library/macosx”.