Characteristic Locus
Inheritance object ObservableBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> > Lsm6dsox
Implements IObservable<IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>> ISamplingSensor<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> ISensor<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> IGyroscope ISamplingSensor<AngularVelocity3D> ISensor<AngularVelocity3D> IAccelerometer ISamplingSensor<Acceleration3D> ISensor<Acceleration3D> II2cPeripheral
Inherited Members PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.StartUpdating(TimeSpan?) PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.StopUpdating() SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.samplingLock SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.Updated SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.SamplingTokenSource SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.Conditions SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.IsSampling SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.UpdateInterval SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.ReadSensor() SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>) SamplingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.Read() ObservableBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.observers ObservableBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.NotifyObservers(IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>) ObservableBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.Subscribe(IObserver<IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>>) ObservableBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>.CreateObserver(Action<IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>>, Predicate<IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>>) 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 Lsm6dsox.dll

Syntax

public class Lsm6dsox : PollingSensorBase<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>, IObservable<IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>>, ISamplingSensor<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>, ISensor<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>, IGyroscope, ISamplingSensor<AngularVelocity3D>, ISensor<AngularVelocity3D>, IAccelerometer, ISamplingSensor<Acceleration3D>, ISensor<Acceleration3D>, II2cPeripheral

Constructors

Lsm6dsox(II2cBus, byte)

Create a new instance of an Lsm6dsox 3D accelerometer and 3D gyroscope sensor.

Declaration
public Lsm6dsox(II2cBus i2cBus, byte address = 106)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus connected to the sensor

byte address

The I2C address

Properties

Acceleration3D

Current Acceleration 3D

Declaration
public Acceleration3D? Acceleration3D { get; }

Property Value

Type Description
Acceleration3D?

AngularVelocity3D

Current Magnetic Field 3D

Declaration
public AngularVelocity3D? AngularVelocity3D { get; }

Property Value

Type Description
AngularVelocity3D?

DefaultI2cAddress

The default I2C address for the peripheral

Declaration
public byte DefaultI2cAddress { get; }

Property Value

Type Description
byte

Methods

GetAccelerometerFullScale()

Retrieves the current full scale setting of the accelerometer

Declaration
public Lsm6dsox.AccelFullScale GetAccelerometerFullScale()

Returns

Type Description
Lsm6dsox.AccelFullScale

The current full scale setting, represented by the Lsm6dsox.AccelFullScale enum.

GetAccelerometerOutputDataRate()

Retrieves the current output data rate setting for the accelerometer.

Declaration
public Lsm6dsox.OutputDataRate GetAccelerometerOutputDataRate()

Returns

Type Description
Lsm6dsox.OutputDataRate

The current output data rate setting.

GetGyroscopeOutputDataRate()

Retrieves the current output data rate setting for the gyroscope.

Declaration
public Lsm6dsox.OutputDataRate GetGyroscopeOutputDataRate()

Returns

Type Description
Lsm6dsox.OutputDataRate

The current output data rate setting.

RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>)

Raise events for subscribers and notify of value changes

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

Parameters

Type Name Description
IChangeResult<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> changeResult

The updated sensor data

Overrides

ReadSensor()

Reads data from the sensor

Declaration
protected override Task<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)> ReadSensor()

Returns

Type Description
Task<(Acceleration3D? Acceleration3D, AngularVelocity3D? AngularVelocity3D)>

The latest sensor reading

Overrides

SetAccelerometerFullScale(AccelFullScale)

Sets the full scale of the accelerometer

Declaration
public void SetAccelerometerFullScale(Lsm6dsox.AccelFullScale fullScale)

Parameters

Type Name Description
Lsm6dsox.AccelFullScale fullScale

The desired full scale setting, specified by the Lsm6dsox.AccelFullScale enum.

SetAccelerometerOutputDataRate(OutputDataRate)

Sets the output data rate for the accelerometer.

Declaration
public void SetAccelerometerOutputDataRate(Lsm6dsox.OutputDataRate dataRate)

Parameters

Type Name Description
Lsm6dsox.OutputDataRate dataRate

The desired output data rate setting.

SetGyroscopeOutputDataRate(OutputDataRate)

Sets the output data rate for the gyroscope.

Declaration
public void SetGyroscopeOutputDataRate(Lsm6dsox.OutputDataRate dataRate)

Parameters

Type Name Description
Lsm6dsox.OutputDataRate dataRate

The desired output data rate setting.

Events

Acceleration3DUpdated

Event raised when acceleration changes

Declaration
public event EventHandler<IChangeResult<Acceleration3D>> Acceleration3DUpdated

Event Type

Type Description
EventHandler<IChangeResult<Acceleration3D>>

AngularVelocity3DUpdated

Event raised when magnetic field changes

Declaration
public event EventHandler<IChangeResult<AngularVelocity3D>> AngularVelocity3DUpdated

Event Type

Type Description
EventHandler<IChangeResult<AngularVelocity3D>>