Changes

Jump to: navigation, search

Week 4 Lab

300 bytes removed, 04:48, 21 April 2009
controlling from a Processing app
* In Processing, open a new sketch, and copy this code into it. Save this sketch as "arduino_test" or something like that. It should look like this:
[[Image:Arduino_serialtest_processing.png]]
** Try running this sketch. When you do, it may give you an error about "COM1" or something of that sort. You need to tell the program what serial port your arduino is connected to. On my computerWhen the program runs, you will see a list of Serial ports, I you can see this output mine in the Processing window:  Available serial ports: Stable Library Native lib Version = RXTX-2picture above.1-7 Java lib Version = RXTX-2.1-7 [0] "/dev/tty.modem" [1] "/dev/cu.modem" [2] "/dev/tty.usbserial-A900acnt" [3] "/dev/cu.usbserial-A900acnt" [4] "/dev/tty.Bluetooth-PDA-Sync" [5] "/dev/cu.Bluetooth-PDA-Sync" [6] "/dev/tty.Bluetooth-Modem" [7] "/dev/cu.Bluetooth-Modem"* On my comnputer, I know see that my serial port is the "tty.usbserial-A900acnt", which is listed as device number 2 ([2]), so I go back into the processing code and change the line that says <code>port = new Serial</code>... to read <code>port = new Serial(this, Serial.list()[2], 9600);</code>
** Now if I run the sketch again, I know that it will be properly communicating with the Arduino. You will need to modify that line to reflect whichever serial port your arduino is connected to.
* Upload the original (unmodified) Dimmer code to your arduino in the arduino software. Your processor should now be running that code... waiting for input!

Navigation menu