Ariane Soft PPL2 Pocket Programming DataMite
  #1  
Old 01-24-2009, 09:39 PM
zehlein's Avatar
zehlein zehlein is offline
Senior Member
 
Join Date: Sep 2006
Location: Leipzig, Germany
Posts: 596
Default GSensor access for HTC devices

I'm currently playing around with the GSensor (acceleration sensor) of my HTC Touch Diamond using a code that was provided by Berunin in this thread.
I changed the code a bit to have it working flawlessly and it is measuring the acceleration forces quite nicely now. You find the source in the attached file.
Attached Files
File Type: zip HTC_GSensor_Access.zip (1.2 KB, 365 views)
__________________
There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Reply With Quote
  #2  
Old 01-25-2009, 05:12 AM
BERUNIN BERUNIN is offline
Junior Member
 
Join Date: Apr 2007
Posts: 21
Default

Good Work Zehlein !!
I like it ..
Perfect speed !! .)

Berunin
Reply With Quote
  #3  
Old 01-25-2009, 06:36 PM
kornalius kornalius is offline
Administrator
 
Join Date: Apr 2006
Posts: 551
Default

Great stuff. Thank you very much for your efforts.
__________________
Regards,
Alain Deschenes
ArianeSoft Inc.
http://www.arianesoft.ca
Reply With Quote
  #4  
Old 03-02-2009, 01:00 PM
Mike Halliday's Avatar
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default

This is great! - Just got my Touch Diamond and tried the code. Works like a charm.

Many thanks zehlein & berunin;

Mike.
__________________
Past editor of 'Voice of the PPL' the BI-Monthly Disk Magazine for the PPL by the PeoPLe!

Still developing products using PPL! - Although not as many as I used to!


If you enjoy my PPL applications and want to see many more, or I have helped you in any way; click here to buy me a beer;
Reply With Quote
  #5  
Old 03-02-2009, 01:18 PM
Mike Halliday's Avatar
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default

OK, I maybe doing something wrong, but i have added the code to one of my programs, and cant get my head around the movement readings;

If I hold the phone vertically with the screen facing me and move up and down I expected the Y values to increase (UP) and decrease (DOWN) - I take it that this is not how it works?

Do you have any pointers on how to read sensible data from the accelerometers? - Do I need to MODULUS the numbers or something?

Any help greatly welcome!

Cheers

Mike
__________________
Past editor of 'Voice of the PPL' the BI-Monthly Disk Magazine for the PPL by the PeoPLe!

Still developing products using PPL! - Although not as many as I used to!


If you enjoy my PPL applications and want to see many more, or I have helped you in any way; click here to buy me a beer;
Reply With Quote
  #6  
Old 03-02-2009, 03:54 PM
zehlein's Avatar
zehlein zehlein is offline
Senior Member
 
Join Date: Sep 2006
Location: Leipzig, Germany
Posts: 596
Default

Tilting left and right is measured by AccX, up and down movements by AccY. Lying flat, face up should result in AccX and AccY being zero.
There is something essential about the sensorpolling you should bear in mind: if you poll too frequently (say time between polls < 40ms) the sensor "freezes" and you get always the same results, even though the device is moved. The same applies if GameAPI uses too much processing time. Just play with the InitGameAPIEx values to get it to work.
__________________
There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Reply With Quote
  #7  
Old 03-02-2009, 04:10 PM
Mike Halliday's Avatar
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default

Hee hee,

I need eyes that work really quick for this.

I cant see what values I have on the screen when I move the phone up and down in front of me! - I need slo-mo vision I think.

Will have a re-think on this one and see if I can work out Max and Min values maybe for each axis.

Thanks for the response

Mike.
__________________
Past editor of 'Voice of the PPL' the BI-Monthly Disk Magazine for the PPL by the PeoPLe!

Still developing products using PPL! - Although not as many as I used to!


If you enjoy my PPL applications and want to see many more, or I have helped you in any way; click here to buy me a beer;
Reply With Quote
  #8  
Old 03-02-2009, 04:17 PM
zehlein's Avatar
zehlein zehlein is offline
Senior Member
 
Join Date: Sep 2006
Location: Leipzig, Germany
Posts: 596
Default

The values should reach from -1000 to +1000 for each axis, approximately (for just tilting). It depends a bit on the calibration of the sensor.
__________________
There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Reply With Quote
  #9  
Old 03-02-2009, 04:25 PM
Mike Halliday's Avatar
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default

hhhmm, could be that then. maybe I will have a go at re-calibrating the sensor
__________________
Past editor of 'Voice of the PPL' the BI-Monthly Disk Magazine for the PPL by the PeoPLe!

Still developing products using PPL! - Although not as many as I used to!


If you enjoy my PPL applications and want to see many more, or I have helped you in any way; click here to buy me a beer;
Reply With Quote
  #10  
Old 03-03-2009, 03:58 PM
Mike Halliday's Avatar
Mike Halliday Mike Halliday is offline
Senior Member
 
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Default Telemetry and PPL

Right, I think I have figured this out.

I re-aligned my gsensor, but the test program still jumps between numbers, I do not get a constant reading, even when the phone is laid flat on the desk.

I am going to try something a little more convention now instead of trying something that was harder than I initially thought.

Something good will be released when I have it polished!

M.
__________________
Past editor of 'Voice of the PPL' the BI-Monthly Disk Magazine for the PPL by the PeoPLe!

Still developing products using PPL! - Although not as many as I used to!


If you enjoy my PPL applications and want to see many more, or I have helped you in any way; click here to buy me a beer;
Reply With Quote
Reply

Tags
acceleration sensor, gsensor, htc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:00 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.
Copyright © 2009 www.ppl-lang.com - All rights reserved
Web Design by BR Web Consulting Ltd