Hi, I'm trying to use TiSensorTag to create an iOS Application. I downloaded the application sample project from this url: http://www.ti.com/tool/sensortag-sw. Then I download the official App from the AppStore named "SensorTag".
I compared the results of the two differents app about the values of accelerometer and I noticed that the orientation of axes is different depending of the application the user uses. The code shown in the sample project to read the data of accelerometer is this:
+(float) calcXValue:(NSData *)data {
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[0] * 1.0) / (256 / KXTJ9_RANGE));
}
+(float) calcYValue:(NSData *)data {
//Orientation of sensor on board means we need to swap Y (multiplying with -1)
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[1] * 1.0) / (256 / KXTJ9_RANGE)) * -1;
}
+(float) calcZValue:(NSData *)data {
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[2] * 1.0) / (256 / KXTJ9_RANGE));
}
+(float) getRange {
return KXTJ9_RANGE;
}
Moreover I didn't understand the meaning of the KXTJ9_RANGE constant. Could you explain me, please?
And could you help me to know how to fix the bug of orientation?
Thanks.