Capture the mouse data and send to Arduino

I would like to capture my mouse coordinates information and send it to Arduino via the USB interface - the same wire that connect the PC's Arduino IDE to Arduino itself. Is this possible?

Ie, while Arduino is executing the loop(){} function, is it possible for it to use the USB as input? While executing the loop(){} it is resend new compiled PDE down the USB to Arduino, so as to intercepting its execution. Can someone point me to where I can find how these are implemented inside the firmware/bootloader of Arduino?

Thanks. :)

Yes, this is possible. There is an application called Processing ( that has examples of collecting mouse position data, and examples of using the serial port to send data to the Arduino.

The Arduino can use the Serial class (begin(), available(), read(), write(), print(), and println()) to communicate with the serial port.

The FTDI chip on the Arduino converts the USB data to serial port data.

Sending a new sketch to the Arduino, while it is running a sketch is not possible.