stk500 is an Erlang implementation of enough of the STK500 protocol to talk to an Arduino.
% Open the serial device attached to the Arduino
% The Diecimila uses 19200
{ok,FD} = stk500:open("/dev/ttyUSB0", [{speed, 19200}]),
% Read a hex file generated by the Arduino IDE
%
% hex_file/1 returns a list of binaries as read from the
% file (16 bytes). It's faster to use 128 bytes chunks.
Hex = stk500:hex_file("doc/counter.cpp.hex"),
Bytes = stk500:chunk(Hex, 128),
stk500:load(FD, Bytes).
The STK500 protocol documentation can be found here:
http://www.atmel.com/Images/doc2525.pdf