Skip to main content

Meadow.Foundation.Sensors.Motion.ParallaxPir

ParallaxPir
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Sensors.Motion.ParallaxPir

The Parallax PIR detects motion via infrared. It emits a high signal over the data pin when motion is detected. The pin returns to a low state when motion stops.

Code Example

private ParallaxPir parallaxPir;

public override Task Initialize()
{
Resolver.Log.Info("Initialize...");

parallaxPir = new ParallaxPir(Device.CreateDigitalInterruptPort(Device.Pins.D05, InterruptMode.EdgeBoth, ResistorMode.Disabled));

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

return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

The Parallax PIR sensor requires only three connections, power, ground and motion detection signal:

Class ParallaxPir

Represents a Parallax Passive Infrared (PIR) motion sensor.

Assembly: ParallaxPir.dll
View Source
Declaration
public class ParallaxPir : IDisposable

Implements:
System.IDisposable

Properties

IsDisposed

Gets a value indicating whether the object is disposed.

View Source
Declaration
public bool IsDisposed { get; }

Methods

Dispose()

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

View Source
Declaration
public void Dispose()

Dispose(bool)

Disposes of the object and releases any associated resources.

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingA value indicating whether the object is being disposed.

Events

OnMotionStart

Event raised when motion is detected.

View Source
Declaration
public event ParallaxPir.MotionChange OnMotionStart
Event Type

Meadow.Foundation.Sensors.Motion.ParallaxPir.MotionChange

OnMotionEnd

Event raised when the PIR sensor indicates that there is no longer any motion.

View Source
Declaration
public event ParallaxPir.MotionChange OnMotionEnd
Event Type

Meadow.Foundation.Sensors.Motion.ParallaxPir.MotionChange

Implements

  • System.IDisposable