The below discussion may have some useful info and examples.
http://arduino.cc/forum/index.php/topic,144675.0.html