Remarks

3-AxisDigitalAccelerometer16g
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Motion.3-AxisDigitalAccelerometer_16g

Code Example

ThreeAxisDigitalAccelerometer16g sensor;

public override Task Initialize()
{
    Console.WriteLine("Initializing");

    sensor = new ThreeAxisDigitalAccelerometer16g(Device.CreateI2cBus());
    sensor.SetPowerState(false, false, true, false, ThreeAxisDigitalAccelerometer16g.Frequencies.TwoHz);

    sensor.Updated += (sender, result) =>
    {
        Console.WriteLine($"Accel: [X:{result.New.X.MetersPerSecondSquared:N2}," +
            $"Y:{result.New.Y.MetersPerSecondSquared:N2}," +
            $"Z:{result.New.Z.MetersPerSecondSquared:N2} (m/s^2)]");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    sensor.StartUpdating(TimeSpan.FromMilliseconds(500));

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

ThreeAxisDigitalAccelerometer16g Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00
Characteristic Locus
Inheritance object ObservableBase<Acceleration3D> SamplingSensorBase<Acceleration3D> PollingSensorBase<Acceleration3D> ByteCommsSensorBase<Acceleration3D> Adxl345 > ThreeAxisDigitalAccelerometer16g
Implements IObservable<IChangeResult<Acceleration3D>> IDisposable IAccelerometer ISamplingSensor<Acceleration3D> ISensor<Acceleration3D> II2cPeripheral
Inherited Members Adxl345.DefaultI2cAddress Adxl345.Acceleration3DUpdated Adxl345.MinimumPollingPeriod Adxl345.Acceleration3D Adxl345.OffsetX Adxl345.OffsetY Adxl345.OffsetZ Adxl345.ReadSensor() Adxl345.RaiseEventsAndNotify(IChangeResult<Acceleration3D>) Adxl345.SetPowerState(bool, bool, bool, bool, Adxl345.Frequencies) Adxl345.SetDataFormat(bool, bool, bool, bool, Adxl345.GForceRanges) Adxl345.SetDataRate(byte, bool) Adxl345.DisplayRegisters() ByteCommsSensorBase<Acceleration3D>.BusComms ByteCommsSensorBase<Acceleration3D>.ReadBuffer ByteCommsSensorBase<Acceleration3D>.WriteBuffer ByteCommsSensorBase<Acceleration3D>.Init(int, int) ByteCommsSensorBase<Acceleration3D>.Dispose(bool) ByteCommsSensorBase<Acceleration3D>.Dispose() PollingSensorBase<Acceleration3D>.StartUpdating(TimeSpan?) PollingSensorBase<Acceleration3D>.StopUpdating() SamplingSensorBase<Acceleration3D>.samplingLock SamplingSensorBase<Acceleration3D>.Updated SamplingSensorBase<Acceleration3D>.SamplingTokenSource SamplingSensorBase<Acceleration3D>.Conditions SamplingSensorBase<Acceleration3D>.IsSampling SamplingSensorBase<Acceleration3D>.UpdateInterval SamplingSensorBase<Acceleration3D>.Read() ObservableBase<Acceleration3D>.observers ObservableBase<Acceleration3D>.NotifyObservers(IChangeResult<Acceleration3D>) ObservableBase<Acceleration3D>.Subscribe(IObserver<IChangeResult<Acceleration3D>>) ObservableBase<Acceleration3D>.CreateObserver(Action<IChangeResult<Acceleration3D>>, Predicate<IChangeResult<Acceleration3D>>) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Grove.Sensors.Motion
Assembly 3-AxisDigitalAccelerometer_16g.dll

Syntax

public class ThreeAxisDigitalAccelerometer16g : Adxl345, IObservable<IChangeResult<Acceleration3D>>, IDisposable, IAccelerometer, ISamplingSensor<Acceleration3D>, ISensor<Acceleration3D>, II2cPeripheral

Constructors

ThreeAxisDigitalAccelerometer16g(II2cBus)

Creates a new ThreeAxisDigitalAccelerometer16g driver

Declaration
public ThreeAxisDigitalAccelerometer16g(II2cBus i2CBus)

Parameters

Type Name Description
II2cBus i2CBus

Remarks

3-AxisDigitalAccelerometer16g
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Motion.3-AxisDigitalAccelerometer_16g

Code Example

ThreeAxisDigitalAccelerometer16g sensor;

public override Task Initialize()
{
    Console.WriteLine("Initializing");

    sensor = new ThreeAxisDigitalAccelerometer16g(Device.CreateI2cBus());
    sensor.SetPowerState(false, false, true, false, ThreeAxisDigitalAccelerometer16g.Frequencies.TwoHz);

    sensor.Updated += (sender, result) =>
    {
        Console.WriteLine($"Accel: [X:{result.New.X.MetersPerSecondSquared:N2}," +
            $"Y:{result.New.Y.MetersPerSecondSquared:N2}," +
            $"Z:{result.New.Z.MetersPerSecondSquared:N2} (m/s^2)]");
    };

    return Task.CompletedTask;
}

public override Task Run()
{
    sensor.StartUpdating(TimeSpan.FromMilliseconds(500));

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

ThreeAxisDigitalAccelerometer16g Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00