Meadow.Foundation.Sensors.Motion.ParallaxPir
ParallaxPir | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
public class ParallaxPir : IDisposable
Implements:
System.IDisposable
Properties
IsDisposed
Gets a value indicating whether the object is disposed.
View Source
public bool IsDisposed { get; }
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
Dispose(bool)
Disposes of the object and releases any associated resources.
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | A value indicating whether the object is being disposed. |
Events
OnMotionStart
Event raised when motion is detected.
View Source
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
public event ParallaxPir.MotionChange OnMotionEnd
Event Type
Meadow.Foundation.Sensors.Motion.ParallaxPir.MotionChange
Implements
System.IDisposable