Are there any external buttons/controls that can be plugged into the iPhone that can be used within an app. If so, does anyone have any links to any code to use with these controls.
I was thinking of some kind of iPod controller that开发者_开发百科 I could hack that could be plugged into the slot on the bottom of the phone.
Cheers.
Yes. Several USB MIDI controllers are supported via the Camera Connection kit on stock OS iOS devices. An app can use CoreMIDI in/out messages to get input from the buttons on these external MIDI controllers.
But an app can't use a generic hackable USB input device under the stock OS, unless the developer is the manufacturer and also a member of Apple's MFi program.
ADDED:
...or you hack the USB device so that it imitates one of Apple's supported MIDI devices. Example of doing this with an AVR microcontroller is here.
Apple's CoreMIDI reference is here.
ADDED #2:
If you want even more accuracy for a timer app, consider using the mic audio input jack, and connecting some buttons to audio chirp generators (could be done either with analog circuitry or a tiny cheap micro). Use different chirp frequencies for different buttons. Some suitable DSP code on the iPhone could probably determine the relative timings of audio input chirp signals with sub-millisecond accuracy.
There are many solutions to this, most involve jailbreaking the iphone.
The most famous/popular is the iControlPad.
精彩评论