I've already updated the firmware of my Ti SensorTag but now, the values of accelerometer on x, y, z axis are different then before. It may seems that the calculations are wrong. Could you confirm me that or could you tell me the correct way to calculate the values from accelerometer?
At this moment these are the methods that I use to calculate them:
+(float) calcXValue:(NSData *)data {
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[0] * 1.0) / (256 / KXTJ9_RANGE)) * -1;;
}
+(float) calcZValue:(NSData *)data {
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[1] * 1.0) / (256 / KXTJ9_RANGE));
}
+(float) calcYValue:(NSData *)data {
char scratchVal[data.length];
[data getBytes:&scratchVal length:3];
return ((scratchVal[2] * 1.0) / (256 / KXTJ9_RANGE)) * -1;
}
+(float) getRange {
return KXTJ9_RANGE;
}
Where KXTJ9_RANGE= 4.0
Thanks