Page 1 of 2 12 LastLast
Results 1 to 10 of 20
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 ...
  1. #1
    Advanced Array

    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default 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?


  2. #2
    Professional Array

    Join Date
    Sep 2007
    Posts
    75
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    9

    Default

    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.

  3. #3
    Professional Array

    Join Date
    Oct 2007
    Posts
    63
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    9

    Default

    IIRC, those functions are in the IOKit framework, adding a "-framework UIKit" to the linker command should make it work.

  4. #4
    Advanced Array

    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Quote Originally Posted by nop144666 View Post
    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 :/

  5. #5
    Professional Array

    Join Date
    Oct 2007
    Posts
    63
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    9

    Default

    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


  6. #6
    Advanced Array

    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Quote Originally Posted by nop144666 View Post
    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..

  7. #7
    Senior Professional Array ag_oo7's Avatar

    Join Date
    Oct 2007
    Posts
    474
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Could you post your program here for us to have a look?

  8. #8
    Professional Array

    Join Date
    Oct 2007
    Posts
    63
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    9

  9. #9
    Advanced Array

    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    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?

  10. #10
    Advanced Array

    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Ok, I really need to know the samplerate of AcceleratedInx to get on with it (and to avoid using the ugly direct way)


 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. 3GS Accelerometer
    By sincro13 in forum iPhone 3GS
    Replies: 1
    Last Post: 02-20-2010, 06:11 PM
  2. Disable the accelerometer?
    By curtiszzz in forum Free Toolchain Software
    Replies: 1
    Last Post: 01-15-2009, 08:16 PM
  3. Accelerometer calibration?
    By MacDragon in forum Hardware
    Replies: 0
    Last Post: 09-21-2008, 01:40 PM
  4. Need new Accelerometer, what and where?
    By infra in forum Hardware
    Replies: 3
    Last Post: 12-01-2007, 07:04 AM
  5. accelerometer stuck?
    By camster in forum Hardware
    Replies: 1
    Last Post: 11-27-2007, 11:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 09:22 PM.
twitter, follow us!