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: