Characteristic Locus
Inheritance System.Object > Adxl3xxBase > Adxl335 > Adxl337 > Adxl377
Implements IAccelerometer
Namespace Meadow.Foundation.Sensors.Motion
Assembly Adxl3xx.dll

Syntax

public abstract class Adxl3xxBase : SamplingSensorBase<Acceleration3D>, IAccelerometer

Constructors

Adxl3xxBase(IAnalogInputController, IPin, IPin, IPin, Int32, Nullable<Voltage>)

Create a new Adxl3xxBase sensor object

Declaration
protected Adxl3xxBase(IAnalogInputController device, IPin xPin, IPin yPin, IPin zPin, int gravityRange, Voltage? supplyVoltage)

Parameters

Type Name Description
IAnalogInputController device

The device connected to the sensor

IPin xPin

Analog pin connected to the X axis output from the ADXL335 sensor.

IPin yPin

Analog pin connected to the Y axis output from the ADXL335 sensor.

IPin zPin

Analog pin connected to the Z axis output from the ADXL335 sensor.

System.Int32 gravityRange

The gravity rangy

System.Nullable<Voltage> supplyVoltage

The supply voltage (typically 3.3V)

Properties

Acceleration3D

The current acceration value

Declaration
public Acceleration3D? Acceleration3D { get; }

Property Value

Type Description
System.Nullable<Acceleration3D>

GravityRange

Gravity range

Declaration
protected double GravityRange { get; }

Property Value

Type Description
System.Double

SupplyVoltage

Power supply voltage applied to the sensor - this will be set (in the constructor) to 3.3V by default

Declaration
protected Voltage SupplyVoltage { get; }

Property Value

Type Description
Voltage

XAnalogIn

The X analog input port

Declaration
protected IAnalogInputPort XAnalogIn { get; }

Property Value

Type Description
IAnalogInputPort

YAnalogIn

The Y analog input port

Declaration
protected IAnalogInputPort YAnalogIn { get; }

Property Value

Type Description
IAnalogInputPort

ZAnalogIn

The Z analog input port

Declaration
protected IAnalogInputPort ZAnalogIn { get; }

Property Value

Type Description
IAnalogInputPort

Methods

RaiseEventsAndNotify(IChangeResult<Acceleration3D>)

Raise events for subcribers and notify of value changes

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<Acceleration3D> changeResult)

Parameters

Type Name Description
IChangeResult<Acceleration3D> changeResult

The updated sensor data

ReadSensor()

Reads data from the sensor

Declaration
protected override Task<Acceleration3D> ReadSensor()

Returns

Type Description
Task<Acceleration3D>

The latest sensor reading

VoltageToGravity(Voltage)

Convert voltage to gravity

Declaration
protected Acceleration VoltageToGravity(Voltage voltage)

Parameters

Type Name Description
Voltage voltage

The voltage to convert

Returns

Type Description
Acceleration

Acceleration value

Events

Acceleration3DUpdated

Raised when the acceleration value changes

Declaration
public event EventHandler<IChangeResult<Acceleration3D>> Acceleration3DUpdated

Event Type

Type Description
EventHandler<IChangeResult<Acceleration3D>>