: lis3dh

LIS3DH 3 degrees sensor

Methods

: obj = lis3dh(arObj)
: obj = lis3dh(arObj, propertyname, propertyvalue ....)

Constructor to create LIS3DH sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

I2CAddress

I2C address of the sensor (default 0x40)

Bus

I2C bus - 0 or 1 (default 0)

Outputs

obj - created object

Example


a = arduino()
sensor = lis3dh(a)

: [readVal, timestamp] = readAcceleration(obj)

Read the acceleration rate

Inputs

obj - the sensor object

Outputs

readVal - the 3 acceleration values

timestamp - timestamp when read

: [readings, overrun] = read(obj)
: [accel, timestamp, overrun] = read(obj)

Read the sensor data

Inputs

obj - the sensor object

Outputs

accel - acceleration reading from sensor.

timestamp - timestamp when read

overrun - overrun flag.

readings - table structure with fields for Timestamp, Acceleration.

: inf = info(obj)

Read the sensor info

Inputs

obj - the sensor object

Outputs

inf - structure containing the sensor information.

Structure fields are:

SensorId

sensor id value

Type

sensor type ’lis3dh’

Status

sensor status value

: flush(obj)

Flush sensor data

Inputs

obj - the sensor object

Outputs

None

: release(obj)

Release the resources of the sensor

Inputs

obj - the sensor object

Outputs

None

Package: arduino