Remarks

ADXL337
Status
Source code GitHub
NuGet package

The ADXL377 is a low power accelerometer capable of measuring +/- 200g of acceleration along three axes. The ADXL377 is controlled via I2C.

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Adxl377 sensor;

    public MeadowApp()
    {
        sensor = new Adxl377(Device, Device.Pins.A01, Device.Pins.A02, Device.Pins.A03, 500);

        sensor.AccelerationChanged += Sensor_AccelerationChanged;
    }

    void Sensor_AccelerationChanged(object sender, Meadow.Foundation.Sensors.SensorVectorEventArgs e)
    {
        Console.WriteLine($"X: {e.CurrentValue.X}, Y: {e.CurrentValue.Y}, Z: {e.CurrentValue.Z}");
    }
}

Sample projects available on GitHub

Wiring Example

Characteristic Locus
Inheritance System.Object > Adxl377
Inherited Members System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace Meadow.Foundation.Sensors.Motion
Assembly Adxl377.dll

Syntax

public class Adxl377

Constructors

View Source

Adxl377(IIODevice, IPin, IPin, IPin, UInt16, Double)

Declaration
public Adxl377(IIODevice device, IPin x, IPin y, IPin z, ushort updateInterval = 100, double accelerationChangeNotificationThreshold = 0.10000000149011612)

Parameters

Type Name Description
IIODevice device
IPin x
IPin y
IPin z
System.UInt16 updateInterval
System.Double accelerationChangeNotificationThreshold

Fields

View Source

MinimumPollingPeriod

Minimum value that can be used for the update interval when the sensor is being configured to generate interrupts.

Declaration
public const ushort MinimumPollingPeriod = 100

Field Value

Type Description
System.UInt16

Properties

View Source

AccelerationChangeNotificationThreshold

Any changes in the acceleration that are greater than the acceleration threshold will cause an event to be raised when the instance is set to update automatically.

Declaration
public double AccelerationChangeNotificationThreshold { get; set; }

Property Value

Type Description
System.Double
View Source

SupplyVoltage

Declaration
public double SupplyVoltage { get; set; }

Property Value

Type Description
System.Double
View Source

X

Acceleration along the X-axis.

Declaration
public double X { get; }

Property Value

Type Description
System.Double

Remarks

This property will only contain valid data after a call to Read or after an interrupt has been generated.

View Source

XVoltsPerG

Volts per G for the X axis.

Declaration
public double XVoltsPerG { get; set; }

Property Value

Type Description
System.Double
View Source

Y

Acceleration along the Y-axis.

Declaration
public double Y { get; }

Property Value

Type Description
System.Double

Remarks

This property will only contain valid data after a call to Read or after an interrupt has been generated.

View Source

YVoltsPerG

Volts per G for the X axis.

Declaration
public double YVoltsPerG { get; set; }

Property Value

Type Description
System.Double
View Source

Z

Acceleration along the Z-axis.

Declaration
public double Z { get; }

Property Value

Type Description
System.Double

Remarks

This property will only contain valid data after a call to Read or after an interrupt has been generated.

View Source

ZVoltsPerG

Volts per G for the X axis.

Declaration
public double ZVoltsPerG { get; set; }

Property Value

Type Description
System.Double

Methods

View Source

GetRawSensorData()

Get the raw analog input values from the sensor.

Declaration
public Task<Vector> GetRawSensorData()

Returns

Type Description
System.Threading.Tasks.Task<Vector>

Vector object containing the raw sensor data from the analog pins.

View Source

Update()

Read the sensor output and convert the sensor readings into acceleration values.

Declaration
public Task Update()

Returns

Type Description
System.Threading.Tasks.Task

Events

View Source

AccelerationChanged

Event to be raised when the acceleration is greater than +/- AccelerationChangeNotificationThreshold.

Declaration
public event SensorVectorEventHandler AccelerationChanged

Event Type

Type Description
SensorVectorEventHandler