View Single Post
  #11 (permalink)  
Old 07-23-2008, 01:55 PM
agraham's Avatar
agraham agraham is offline
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,907
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Mr_Gee View Post
No there is nothing else
Wrong! There is a lot more information there. It shows how important it is to describe exactly and in detail rather than just saying an exception occurred.

I think that the dll might actually be working, it is your code that is trying to use the returned information incorrectly. From my earlier post
Quote:
Dim data(0)
...
HTCGSensor.New
...
data() = HTCGSensor.GetRawSensorData

In the unlikely event that it works the data is returned in a 20 byte array described in the struct at the start of the source file in the zip. You can reassemble the data the hard way by multiplying and adding bytes or by using my ByteConverter library
You have to assign the returned data to an array and pick it apart from there. The array will be an array of bytes that you have to transform to the required numbers. With my ByteConverter library it looks likes this (there may be typos/errors, I haven't actually tried the code).

Code:
TiltX = ByteConv.Int16FromBytes(data(), 0) ' From -1000 to 1000 (about), 0 is flats
TiltY = ByteConv.Int16FromBytes(data(), 2) ' From -1000 to 1000 (about), 0 is flatshort
TiltZ = ByteConv.Int16FromBytes(data(), 4) ' From -1000 to 1000 (about), 0 is flat
Unknown1 = ByteConv.Int16FromBytes(data(), 6) ' Always zero
AngleY = ByteConv.Int32FromBytes(data(), 8) 'From 0 to 359
AngleX = ByteConv.Int32FromBytes(data(), 12) 'From 0 to 359
Unknown2 = ByteConv.Int16FromBytes(data(), 16) ' Bitfield?
Reply With Quote