This code snippet show how to access a text file stored in the device's SD card.
code (hosted at www.anddev.org)This tutorial show how to create a new xml file in the device's SD card.
The steps to make it are:
If you are working with an accelerometer, you may find useful to use these formulas:
This is if you need total acceleration (the magnitude of the vector sum of the acceleration along the X, Y & Z axes):
double totAcc = Math.sqrt((accX*accX)+(accY*accY)+(accZ*accZ));
This use the acceleration along an axis in order to compute the inclination, or tilt, of that axis with respect to the total acceleration the device is experiencing.
If the device is at rest then the tilt is measured with respect to gravity.
double tiltX = Math.asin(accX/totAcc);
double tiltY = Math.asin(accY/totAcc);
double tiltZ = Math.asin(accZ/totAcc);
I used the formulas as explained in the SunSPOT Accelerometer reference