Reference.EsploraReadAccelerometer History

Hide minor edits - Show changes to markup

December 12, 2012, at 12:59 PM by Federico -
Changed lines 49-50 from:
to:
December 07, 2012, at 11:03 PM by Scott Fitzgerald -
Changed lines 11-12 from:

readAccelerometer(axis)

to:

Esplora.readAccelerometer(axis)

December 04, 2012, at 08:22 PM by Scott Fitzgerald -
Changed line 27 from:

[@

to:
Changed line 49 from:

}

to:
December 04, 2012, at 08:21 PM by Scott Fitzgerald -
Changed lines 7-8 from:

On the esplora there is a 3-Axis accelerometer with a +/- 1.5g range of measurements With the readAccelerometer() funcion you can read one axis at a time.

to:

Reads values from the Esplora's accelerometer. Each of the three axes are accessed independently.

Changed lines 11-12 from:

readAccelerometer()

to:

readAccelerometer(axis)

Changed lines 15-16 from:

To choose which one of the 3 available axis, you must pass one of this three constants:

to:

axis : char, determines what axis to read.

Changed lines 23-25 from:

return the raw value of the readings of the choosen axis. The accelerometer returns zero when is ortogonal to the gravity vector and positive or negative values when is accelerating in one of the two directions of the axis.

to:

int : the value of the readings on the chosen axis. The accelerometer returns zero when it is perpendicular to the direction of gravity. Positive or negative values result when it is accelerates in one of the two directions of the axis.

December 03, 2012, at 04:22 PM by Federico -
Added lines 1-52:

Esplora

readAccelerometer()

Description

On the esplora there is a 3-Axis accelerometer with a +/- 1.5g range of measurements With the readAccelerometer() funcion you can read one axis at a time.

Syntax

readAccelerometer()

Parameters

To choose which one of the 3 available axis, you must pass one of this three constants:

X_AXISto read the X-axis value
Y_AXISto read the Y-axis value
Z_AXISto read the Z-axis value

Returns

return the raw value of the readings of the choosen axis. The accelerometer returns zero when is ortogonal to the gravity vector and positive or negative values when is accelerating in one of the two directions of the axis.

Example

#include <Esplora.h>

void setup()
{
 Serial.begin(9600);
} 

void loop()
{
 int x_axis = Esplora.readAccelerometer(X_AXIS);
 int y_axis = Esplora.readAccelerometer(Y_AXIS);
 int z_axis = Esplora.readAccelerometer(Z_AXIS);

 Serial.print("x: ");
 Serial.print(x_axis);
 Serial.print("\ty: ");
 Serial.print(y_axis);
 Serial.print("\tz: ");
 Serial.println(z_axis);

 delay(500);
}

Share