In the arduino development environment, there is a serial monitor that do the the testing.
Since it is just a standard serial interface, so one can just do it anyway they want. Here I show how to do it via python. First what we need, is the pyserial library, you can install it using pip or easy_install or grab it from pyserial site
To install, just use to following command. if you need more detail, read the docs, because I use python 2.7 it just works for me,
easy_install pyserialTo use it, with the arduino code from the top of the page just, do the following
The line s=serial.Serial(2) points to com3 on windows, on linux it should be s=serial.Serial('/dev/ttyUSB0'), or other port that shown by the arduino serial monitor. Pyserial actually have a few options on the Serial object, but I found that for arduino, the default is adequate.
And this is how to use arduino to interface to your computer using python. enjiy