HC Gilje has posted an excellent guide to serial communications with external devices using the iPhone. There are lots of resources out there for setting up serial devices, but the landscape is fragmented. And as always, Apple is not exactly falling all over themselves to let you hook up peripherals. As Gilje succinctly puts it:
Apple has not made it easy to let the iphone communicate with external devices. Basically, you need a jailbroken phone to do anything.