This week our assignment is to write an application that interfaces with an input &/or output device that you made.
I used Processing and Arduino to do this assignment.
Processing enables you to program the resources on the screen. And Arduino enables you to program the hardware. They communicate with each other via serial port.

Processing and Arduino come with rich library resources. In Processing, there is a library called Serial describing how processing can use the data flowing in the serial port.
Open the SimpleWrite example, then here is more or less the structure for a 101 project to connect Processing and Arduino.

In this sketch, processing will send a H to serial port when mouse over a square on the canvas, and a L when outside of the square.
For the Arduino side, I wrote a sketch that detected if something happens in the serial port. and if so, is it H or L. I connected a servo and an LED on the circuit board I made. And when a H received, set the position of the servo to 180 and turn the LED on. If L, do the opposite.
Hardware connection:

