I would like to develop an (personal) iphone app to use the iPhone as a controller for a small device such as a fan or for example a light bulb. Does anyone 开发者_如何转开发know if there is some kind of controllable iphone-dock to use for something like this. And are there some kind of methods to use with such a dock? For example the fan just needs a variable voltage for different rpm.
Thanks in advance,
EAAccessory
requires that you become a Apple hardware partner, which is very expensive and not easy (this is why you only see large companies releasing hardware accessories for iOS devices).
There's a few ways around this. The easiest way is to have your app send OSC signals over WIFI to an OSC server. I've set this up before using TouchOSC on the iPhone and an Arduino connected to my desktop via USB. It's not hard at all, but it requires that you have an Arduino connected to a computer; it's not ideal.
Alternatively you can use audio output to send commands over the line output in the iPhone's dock connector, effectively turning the iPhone into a software modem.
Good luck and if you get this figured out, post the code on github. :-D
EAAccessory framework might not be what you want because of the requirement for you to have the license and hardware. You could better implement some sort of small webserver that runs an arduino or something similar. check this out for an example of that. on the arduino, you could just have a 5v relay to control the switch of whatever device and have the other pins of the relay connected to a hot (or cold depending on the relay state) standard 120v plug so you can plug anything into it. here is a good project for arduino controlled relay
for direct serial control, you could do something like this but it would require being jailbroken. i think for a personal app, doing it via wifi would be the best way unless you jailbreak and install the full bluetooth stack where you do not need EAAccessory stuff
Check out EAAccessory Framework. Used to handle external devices.
You could try using an ultrasound detector attached to your device, and playing an audio file at the appropriate frequency etc. on the iPhone.
精彩评论