Characteristic Locus
Inheritance object ObservableBase<Acceleration3D> SamplingSensorBase<Acceleration3D> PollingSensorBase<Acceleration3D> > Adxl3xxBase > Adxl335 > Adxl337 > Adxl377
Implements IObservable<IChangeResult<Acceleration3D>> IAccelerometer ISamplingSensor<Acceleration3D> ISensor<Acceleration3D> IDisposable
Inherited Members PollingSensorBase<Acceleration3D>.StartUpdating(TimeSpan?) PollingSensorBase<Acceleration3D>.StopUpdating() SamplingSensorBase<Acceleration3D>.samplingLock SamplingSensorBase<Acceleration3D>.Read() SamplingSensorBase<Acceleration3D>.SamplingTokenSource SamplingSensorBase<Acceleration3D>.Conditions SamplingSensorBase<Acceleration3D>.IsSampling SamplingSensorBase<Acceleration3D>.UpdateInterval SamplingSensorBase<Acceleration3D>.Updated ObservableBase<Acceleration3D>.NotifyObservers(IChangeResult<Acceleration3D>) ObservableBase<Acceleration3D>.Subscribe(IObserver<IChangeResult<Acceleration3D>>) ObservableBase<Acceleration3D>.CreateObserver(Action<IChangeResult<Acceleration3D>>, Predicate<IChangeResult<Acceleration3D>>) ObservableBase<Acceleration3D>.observers object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Motion
Assembly Adxl3xx.dll

Syntax

public abstract class Adxl3xxBase : PollingSensorBase<Acceleration3D>, IObservable<IChangeResult<Acceleration3D>>, IAccelerometer, ISamplingSensor<Acceleration3D>, ISensor<Acceleration3D>, IDisposable

Constructors

Adxl3xxBase(IPin, IPin, IPin, int, 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.

int gravityRange

The gravity rangy

Voltage? supplyVoltage

The supply voltage (typically 3.3V)

Properties

Acceleration3D

The current acceleration value

Declaration
public Acceleration3D? Acceleration3D { get; }

Property Value

Type Description
Acceleration3D?

GravityRange

Gravity range

Declaration
protected double GravityRange { get; }

Property Value

Type Description
double

IsDisposed

Is the object disposed

Declaration
public bool IsDisposed { get; }

Property Value

Type Description
bool

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

XAnalogInputPort

The X analog input port

Declaration
protected IAnalogInputPort XAnalogInputPort { get; }

Property Value

Type Description
IAnalogInputPort

YAnalogInputPort

The Y analog input port

Declaration
protected IAnalogInputPort YAnalogInputPort { get; }

Property Value

Type Description
IAnalogInputPort

ZAnalogInputPort

The Z analog input port

Declaration
protected IAnalogInputPort ZAnalogInputPort { get; }

Property Value

Type Description
IAnalogInputPort

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
bool disposing

Is disposing

RaiseEventsAndNotify(IChangeResult<Acceleration3D>)

Raise events for subscribers and notify of value changes

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

Parameters

Type Name Description
IChangeResult<Acceleration3D> changeResult

The updated sensor data

Overrides

Meadow.Foundation.SamplingSensorBase<Meadow.Units.Acceleration3D>.RaiseEventsAndNotify(Meadow.IChangeResult<Meadow.Units.Acceleration3D>)

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<Meadow.Units.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>>