Discuss Polling the accelerometer at the Free Toolchain Software - Hackint0sh.org; Hi, I need some input about a very simple application I'm about to make.
I ...
-
Polling the accelerometer
Hi, I need some input about a very simple application I'm about to make.
I need to poll the accelerometer, Carl Loodberg (is he a user here?) pointed me to this code snippet -> http://blog.medallia.com/2007/08/iph...source_co.html
I have installed the iPhone toolchain and tested it with a simple Hello World test.
But when I compile the code snippet from the link above I get these errors:
/usr/local/bin/arm-apple-darwin-ld: Undefined symbols:
_IOHIDEventGetFloatValue
_IOHIDEventGetType
_IOHIDEventSystemCopyMatchingServices
_IOHIDEventSystemCreate
_IOHIDEventSystemOpen
_IOHIDServiceSetProperty
_IOMasterPort
collect2: ld returned 1 exit status
Where are the IOHIDEvent calls defined? I guess I just neeed to load another headerfile?
-
-
ld errors are not related to headers, you may be missing a framework in your Makefile.
There is a good accelerometer demo in the lucasnewman motion demo app.
-
-
IIRC, those functions are in the IOKit framework, adding a "-framework UIKit" to the linker command should make it work.
-

Originally Posted by
nop144666
IIRC, those functions are in the IOKit framework, adding a "-framework UIKit" to the linker command should make it work.
Cheers I'll try that.
EDIT: JUst checked my Makefile - I use that allready :/
-
-
That may be a problem with the declaration of the functions... Try adding a extern "C" before them if you are compiling in C++ or Obj-C++... I'm using Obj-C and the following Makefile, and it works ok:
CC=arm-apple-darwin-gcc
LD=$(CC)
LDFLAGS=-lobjc -framework CoreFoundation -framework CoreGraphics -framework GraphicsServices -framework Foundation -framework IOKit -framework UIKit -framework LayerKit
all: Grav
Grav: main.o GravApplication.o
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f *.o Grav
-

Originally Posted by
nop144666
That may be a problem with the declaration of the functions... Try adding a extern "C" before them if you are compiling in C++ or Obj-C++... I'm using Obj-C and the following Makefile, and it works ok:
CC=arm-apple-darwin-gcc
LD=$(CC)
LDFLAGS=-lobjc -framework CoreFoundation -framework CoreGraphics -framework GraphicsServices -framework Foundation -framework IOKit -framework UIKit -framework LayerKit
all: Grav
Grav: main.o GravApplication.o
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f *.o Grav
Cheers, I'll take a look at it as soon as my 1.1.2 update is working..
-
-
Senior Professional
Array
Could you post your program here for us to have a look?
-
-
-
The outputs from the accelerometer - am I right in saying that it is percentage of 2G?
The datasheet says it is either 2G og 8G - if it is 2G, then it makes perfect sense that the Z axis hovers around 0.48 here where I am. (0.96G).
Am I correct on this?
-
Ok, I really need to know the samplerate of AcceleratedInx to get on with it (and to avoid using the ugly direct way)
-
Similar Threads
-
By sincro13 in forum iPhone 3GS
Replies: 1
Last Post: 02-20-2010, 06:11 PM
-
By curtiszzz in forum Free Toolchain Software
Replies: 1
Last Post: 01-15-2009, 08:16 PM
-
By MacDragon in forum Hardware
Replies: 0
Last Post: 09-21-2008, 01:40 PM
-
By infra in forum Hardware
Replies: 3
Last Post: 12-01-2007, 07:04 AM
-
By camster in forum Hardware
Replies: 1
Last Post: 11-27-2007, 11:02 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks