Accelerometer Shield acts as Arduino Shield via 1Sheeld

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

Buy 1Sheeld
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.

Linear Acceleration

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)

 

float getX(void)

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

SYNTAX
AccelerometerSensor.getX();

RETURN
Float acceleration value on the X-axis.

PARAMETERS
None.

USAGE
float xValue = AccelerometerSensor.getX();

 

 

float getY(void)

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

SYNTAX
AccelerometerSensor.getY();

RETURN
Float acceleration value on the Y-axis.

PARAMETERS
None.

USAGE
float yValue = AccelerometerSensor.getY();

 

 

float getZ(void)

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

SYNTAX
AccelerometerSensor.getZ();

RETURN
Float acceleration value on the Z-axis.

PARAMETERS
None.

USAGE
float zValue = AccelerometerSensor.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.

SYNTAX
AccelerometerSensor.setOnValueChange(&userFunctionName);

RETURN
None.

PARAMETERS
&userFunction takes the physical address of your created function in the memory, and called once new data received to execute it’s functionality.

USAGE
void setup()
{
  OneSheeld.begin();
  AccelerometerSensor.setOnValueChange(&myFunction);  
}

void loop()
{
  /*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. */
   Terminal.println(xAxisValue);
   Terminal.println(yAxisValue);
   Terminal.println(zAxisValue);
}