Get all X,Y & Z vectors acceleration from your smartphone by writing 1 line in your sketch.
This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use them in prototyping along with Arduino,so you can get information from the surrounding environment and use it to trigger a certain action. Learn more from the sensor shields tutorial.
Accelerometer sensor measures the acceleration forces in m/s2 that is applied to the device on all three physical axis (x, y and z) including the force of gravity.Range: 0–>20 m/s2 forSamsung galaxy S3, note that this range differs from device to another.
Adding #define CUSTOM_SETTINGS along with #define INCLUDE_ACCELEROMETER_SENSOR_SHIELD is a key that will let you unlock the Accelerometer sensor shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.
By checking the linear acceleration inside the accelerometer shield,the returned values will exclude the value of gravitational force, giving you the exact linear acceleration on each axis (X-Y-Z).(currently supported by Android devices)
Returns acceleration vector on the X-axis of your smartphone.
Float acceleration value on the X-axis.
float xValue = AccelerometerSensor.getX();
Returns acceleration vector on the Y-axis of your smartphone.
Float acceleration value on the Y-axis.
float yValue = AccelerometerSensor.getY();
Returns acceleration vector on the Z-axis of your smartphone.
&userFunction takes the physical address of your created function in the memory, and called once new data received to execute it’s functionality.
/*Write code or leave it empty both will work. */
/* myFunction exists under the loop function. */
/* This function will be invoked each time a new value comes to arduino from the
smartphones accelerometer sensor. */
void myFunction (float xAxisValue, float yAxisValue, float zAxisValue)
/* Print x-y-z axis values on the Terminal Shield. */