Gravity Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld
Gravity Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld

You have access to the gravity sensor on your smart phone on the 3-Axis (X,Y & Z), pull this data from the
gravity sensor on your smartphone to trigger a certain action on the Arduino board. 

This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use
it to trigger a certain action.Learn more from the sensor shields tutorial.

– Gravity sensor measures the gravitational forces in m/s2 that is applied to the device on all three physical axis (x, y and z).
– Gravity sensor Library allows Arduino board to deal with the Gravity sensor of your smartphone.

Adding #define CUSTOM_SETTINGS along with #define INCLUDE_GRAVITY_SENSOR_SHIELD is a key that will let you unlock the Gravity sensor shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.

float getX(void)

Returns gravity vector on the X-axis of your smartphone.

SYNTAX
GravitySensor.getX();

RETURNS
Returns a float holding gravity value on the X-axis.

PARAMETERS
None.

USAGE
float xValue = GravitySensor.getX();

 

float getY(void)

Returns gravity vector on the Y-axis of your smartphone.

SYNTAX
GravitySensor.getY();

RETURNS
Returns a float holding gravity value on the Y-axis.

PARAMETERS
None.

USAGE
float yValue = GravitySensor.getY();

 

float getZ(void)

Returns gravity vector on the Z-axis of your smartphone.

SYNTAX
GravitySensor.getZ();

RETURNS
Returns a float holding gravity value on the Z-axis.

PARAMETERS
None.

USAGE
float zValue = GravitySensor.getZ();

 

void setOnValueChange(void(*userFunction)(float,float,float))

Sets a certain individual function written by the user in the sketch to be called and runs its functionality once a new value is sensed and sent by the application to the Arduino.

SYNTAX
GravitySensor.setOnValueChange(&userFunctionName);

RETURNS
None.

PARAMETERS
&userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.

USAGE
GravitySensor.setOnValueChange(&myFunction);
/* myFunction exists under the loop function. */
/* This function will be invoked each time a new value comes to arduino from the  
   smartphones gravity sensor. */
void myFunction (float xAxisValue, float yAxisValue, float zAxisValue)
{
    /* Print x-y-z axis values on the Terminal Shield. */   
    Terminal.println(xAxisValue);
    Terminal.println(yAxisValue);
    Terminal.println(zAxisValue);
}