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.
Nonetheless, he provides an excellent overview of the options that are available and how to use them. Examples include external GPS units, Blutetooth, and other wireless devices. The post walks through setup of the physical serial connection, proper toolchain setup and port configuration, and finishes with two demo projects to show how it all goes together.
The author mentions the iProcessing language, and how it could be a great option for prototype projects if it could be run as root. Using your iPhone as a hardware development platform would make a lot of sense, especially considering Google’s foray into Android + Arduino with the IOIO board and SDK.
Source: iPhone serial communcations