Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

timpainter

macrumors newbie
Original poster
Mar 20, 2011
5
0
uk
Hi i am new to mac programing
I want to access the compass and tilt compensation function( object?) using the latest x code ios sdk
can anyone point me in the right direction ?
I all so would like to connect to a pic via a serial port?
is this a problem ?
Thanks Tim
 
Last edited:
XCode is just an IDE. I suspect where you say XCode you really mean Cocoa Touch.

Look up Location Services in the API documentation for the compass and accelerometer.

And there is no serial port access.
 
Hi
Thanks for the reply
Yes coca's the stuff to use i will persivere and find the relevent objects and methods

do you know why we are not able to use the serial port? is this apples policy?
may be i will try audio tone instead as i only need to transmit 3 states to a pic
??
Thanks again
Tim
:rolleyes:
 
do you know why we are not able to use the serial port? is this apple policy?

Yes. There is no generic device access at all due to Apple policy. Either via the dock connector or bluetooth. You best/easiest option is WiFi with a discoverable server on the PC/Mac.
 
I believe Apple does allow third party access to the port, but you have to qualify your product. Sorry, I don't know the details of how to go about that. Ditto for Bluetooth beyond it's limited restrictions.
 
I believe Apple does allow third party access to the port, but you have to qualify your product. Sorry, I don't know the details of how to go about that. Ditto for Bluetooth beyond it's limited restrictions.

The MFI program exists for peripheral manufacturers yes, but it does not allow generic access for the type the poster is talking about.
 
I vote for WiFi - audio tone seems more trouble, and not very usable if you need more types of data. A little TCP server on your PC should be easy to do.
 
To use a serial device, such as a pic, you will a wifi to serial converter box, which still seem to be fairly expensive.

Or you might be able to use another pic or other uP to convert modulated audio from the iPhone's headset jack to/from a serial data stream. (There's a university project which does this.)
 
Hi
Thanks all for the advice I like the idea of using an wired audio tone to control a pic
as it seems simple to impliment a frequency meaurement and tone generation with most pic microcontrolers
KIS keep it simple

Tim
 
There are several examples of apps using the serial port for data or analog I/O in the App Store already, so this should be OK. (Most visibly Square: https://squareup.com/)

It just seems wrong after all these years to have to rely on an analog link at 1200 bps between digital devices that are perfectly capable of talking to each other digitally.

I had hoped that the news last year that Apple approved a reference design for dock connector to serial ports http://www.ilounge.com/index.php/news/comments/apple-approves-serial-port-to-dock-connector-design/ was an indication of planned openness on the hardware end, but unfortunately not.

B
 
It's possible to get a ton more than 1200 bps out of an iPhone's headset jack. Even fairly ancient modems with 100X slower DSP chips got a lot more bps out of telco quality mono over kilometer long wires.
 
It's possible to get a ton more than 1200 bps out of an iPhone's headset jack. Even fairly ancient modems with 100X slower DSP chips got a lot more bps out of telco quality mono over kilometer long wires.

Link please. I've seen the existence proof of sustained 1200 bps over the headphone jack http://www.perceptdev.com/labs/content/iphone-rs232-1200-baud-no-jailbreak-required-using-20-sdk published in the book but not much beyond that.

I suspect the path from digital audio to the headphone jack is pretty transparent, but not necessarily the other way around. Is the raw A/D signal (for the mic input in particular) even available or has it already been processed by the time you get it.

EDIT: What do you know, the reference design I mentioned earlier has actually turned into a real product http://www.redpark.com/news.html but it's tied to this Cisco console app. http://itunes.apple.com/us/app/get-console/id412067943?mt=8

B
 
Last edited:
Also see this thread:
https://forums.macrumors.com/threads/1011028/

Around post #9, find "two IR diodes".

The circuit is dead simple. The code to drive it, not quite so simple.

Modular IR receivers are common and inexpensive, e.g.:
http://www.radioshack.com/product/index.jsp?productId=2049727

A distributer like Mouser.com or DigiKey.com has many more choices, but with all those options you have to know what to look for.

For reference, Sony's SIRC protocol:
http://www.sbprojects.com/knowledge/ir/sirc.htm
 
Yes to both.

I don't yet see the need for two-way high-speed communication, with the information given so far.

I don't see a need for high-speed bidirectional links here either, but just wanted to make sure the limitations of that approach were explicit.

I do prefer to get some sort of ack back (where possible) even if by semaphore flags. So, bidirectionally even if highly asymmetric is desirable.

B
 
Hi yes all very interesting but i only need to drive a couple of relays to control some hardware and recieve a reset signal . i have tryed a microsoftwindows
version using rs232 dtr rts signal lines this works ok but i would like to use an iphone instead of a p/c

another idea is pic s support tone dialing protocoll
and is able to send 0 to 15 control tones any comments??
Tim
 
Hi yes all very interesting but i only need to drive a couple of relays to control some hardware and recieve a reset signal . i have tryed a microsoftwindows
version using rs232 dtr rts signal lines this works ok but i would like to use an iphone instead of a p/c

reset from the PIC to the iPhone app (or vice versa)? relay commands from app to relay? Do you have to be able to query the status of the relays, or is it enough to send commands blind.

another idea is pic s support tone dialing protocoll
and is able to send 0 to 15 control tones any comments?

It would seem like your application would work OK with 16 possible commands/responses and there is DTMF code already out there you could build on so why not.

B
 
Much more than 16 if it works on DTMF sequences.

Of course, just keeping it simple, which seems fine for the level of complexity described.

Even a two digit sequence requires more work to validate the stream so why go there unless you have to.

B
 
reset from the PIC to the iPhone app (or vice versa)? relay commands from app to relay? Do you have to be able to query the status of the relays, or is it enough to send commands blind.

reset would be from pic to phone hi/low phone to relays(2) would be blind
Tim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.