Characteristic Locus
Inheritance System.Object ObservableBase<Acceleration3D> SamplingSensorBase<Acceleration3D> PollingSensorBase<Acceleration3D> > Adxl3xxBase > Adxl335 > Adxl337 > Adxl377
Implements ISamplingSensor<Acceleration3D> ISamplingSensor<Acceleration3D> IAccelerometer
Inherited Members PollingSensorBase<Acceleration3D>.StartUpdating(Nullable<TimeSpan>) PollingSensorBase<Acceleration3D>.StopUpdating() SamplingSensorBase<Acceleration3D>.samplingLock SamplingSensorBase<Acceleration3D>.Updated SamplingSensorBase<Acceleration3D>.SamplingTokenSource SamplingSensorBase<Acceleration3D>.Conditions SamplingSensorBase<Acceleration3D>.IsSampling SamplingSensorBase<Acceleration3D>.UpdateInterval SamplingSensorBase<Acceleration3D>.RaiseEventsAndNotify(IChangeResult<>) SamplingSensorBase<Acceleration3D>.Read() ObservableBase<Acceleration3D>.observers ObservableBase<Acceleration3D>.NotifyObservers(IChangeResult<>) Meadow.Foundation.ObservableBase<Acceleration3D>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<Acceleration3D>.CreateObserver(Action<>, System.Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Motion
Assembly Adxl3xx.dll

Syntax

public abstract class Adxl3xxBase : PollingSensorBase<Acceleration3D>, ISamplingSensor<Acceleration3D>, ISamplingSensor<Acceleration3D>, IAccelerometer

Constructors

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

Create a new Adxl3xxBase sensor object

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

Parameters

Type Name Description
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

Overrides

Meadow.Foundation.SamplingSensorBase<Acceleration3D>.ReadSensor()

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>>