Arduino Sketch

Arduino Sketch for handling digital I/O commands via the serial port

The Department uses Arduino boards for several purposes. One common use is as a controller for digital input/output: a way to interface a computer with external devices, and have the computer control them and/or take input from them. This is such a common use that we have developed a standardised Arduino Sketch (firmware you load onto the Arduino board) for controlling and monitoring digital pins.

You plug the board into a USB socket of your computer, then use any piece of software which can address a serial port to issue commands and read results. Your computer can be running any software which has the ability to address a serial port. Inside the department we use PsyScript, a programming environment specially designed for running psychology experiments, but the sketch has also been tested working with Python.

The interface language

The interface language includes commands to set the status of digital pins and find out the status of digital pins. There are plans to extend this to analogue pins. A text file with full documentation for the interface language is included in the (very small) download in the next section.


Download version 1.0.0 of the sketch: Arduino. The download includes full documentation for the interface language and a few programming examples.

Change history

2010/08/10 1.0.0 Initial release


Written for the Arduino Duemilanove but should work on any Arduino.


None. I might try to help if I have time, but I'm not promising anything. But don't hesitate to contact the address included with the documentation and see how busy I am.