Post date: Aug 15, 2010 8:43:53 PM
A variable(val) is created to store information. An LED is assigned to digital pin 4. Digital pin 4 is set as an output. Data is to be sent at 9600 bps. If there is received, it is to be sored in the variable "val." If val is read as " H", turn the LED on. If it is read as "L", turn the LED off. Wait 10 milliseconds before reading val again.
Processing will import the serial library. Processing is set to receive information from the serial port. The variable "val" is declared in processing so that it can interact the the corresponding variable from Arduino. The size of the window is set. Processing is told to read information from the serial port "0". Processing will send are receive information at 9600 bps. The background color is set. The the mouse is over a specified area, the fill color will be a set to a certain shade and val will be declared as an "H". If it is not over the specified area, the fill color will be set to a different shade and val will be declared as an "L". Processing draws a rectangle will a color corresponding to the position of the mouse.