Remarks

PIRMotionSensor
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Motion.PIRMotionSensor

Code Example

PIRMotionSensor motionSensor;

public override Task Initialize()
{
    motionSensor = new PIRMotionSensor(
        Device.CreateDigitalInterruptPort(
            Device.Pins.D13,
            InterruptMode.EdgeBoth,
            ResistorMode.Disabled));

    motionSensor.OnMotionStart += (sender) =>
    {
        Resolver.Log.Info($"Motion start  {DateTime.Now}");
    };

    motionSensor.OnMotionEnd += (sender) =>
    {
        Resolver.Log.Info($"Motion end  {DateTime.Now}");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

PIRMotionSensor Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00
Characteristic Locus
Inheritance object ParallaxPir > PIRMotionSensor
Implements IDisposable
Inherited Members ParallaxPir.Dispose() ParallaxPir.Dispose(bool) ParallaxPir.IsDisposed ParallaxPir.OnMotionStart ParallaxPir.OnMotionEnd 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 PIRMotionSensor.dll

Syntax

public class PIRMotionSensor : ParallaxPir, IDisposable

Constructors

PIRMotionSensor(IDigitalInterruptPort)

Creates a PIRMotionSensor driver

Declaration
public PIRMotionSensor(IDigitalInterruptPort digitalInterruptPort)

Parameters

Type Name Description
IDigitalInterruptPort digitalInterruptPort

Remarks

PIRMotionSensor
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Motion.PIRMotionSensor

Code Example

PIRMotionSensor motionSensor;

public override Task Initialize()
{
    motionSensor = new PIRMotionSensor(
        Device.CreateDigitalInterruptPort(
            Device.Pins.D13,
            InterruptMode.EdgeBoth,
            ResistorMode.Disabled));

    motionSensor.OnMotionStart += (sender) =>
    {
        Resolver.Log.Info($"Motion start  {DateTime.Now}");
    };

    motionSensor.OnMotionEnd += (sender) =>
    {
        Resolver.Log.Info($"Motion end  {DateTime.Now}");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

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

PIRMotionSensor(IPin, InterruptMode, ResistorMode, TimeSpan, TimeSpan)

Creates a PIRMotionSensor driver

Declaration
public PIRMotionSensor(IPin pin, InterruptMode interruptMode, ResistorMode resistorMode, TimeSpan debounceDuration, TimeSpan glitchDuration)

Parameters

Type Name Description
IPin pin

The pin connected to the PIR sensor

InterruptMode interruptMode

The interrupt mode of the pin

ResistorMode resistorMode

The resistor mode of the pin

TimeSpan debounceDuration

The debounce duration

TimeSpan glitchDuration

The glitch duration (can typically be set to zero)

Remarks

PIRMotionSensor
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Motion.PIRMotionSensor

Code Example

PIRMotionSensor motionSensor;

public override Task Initialize()
{
    motionSensor = new PIRMotionSensor(
        Device.CreateDigitalInterruptPort(
            Device.Pins.D13,
            InterruptMode.EdgeBoth,
            ResistorMode.Disabled));

    motionSensor.OnMotionStart += (sender) =>
    {
        Resolver.Log.Info($"Motion start  {DateTime.Now}");
    };

    motionSensor.OnMotionEnd += (sender) =>
    {
        Resolver.Log.Info($"Motion end  {DateTime.Now}");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

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