Meadow.Foundation.Sensors.Motion.Hcsens0040
Hcsens0040 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
The HCSENS0040 is a microwave motion detector commonly found on the RCWL-0516 board. It detects relative motion using the doppler effect. It uses a single GPIO pin to notify Meadow when motion is detected.
Code Example
private Hcsens0040 sensor;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
sensor = new Hcsens0040(Device.CreateDigitalInterruptPort(Device.Pins.D05, Meadow.Hardware.InterruptMode.EdgeBoth));
sensor.OnMotionDetected += Sensor_OnMotionDetected;
return Task.CompletedTask;
}
private void Sensor_OnMotionDetected(object sender)
{
Resolver.Log.Info($"Motion detected {DateTime.Now}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a Hcsens0040 to your Meadow board, connect the following:
Hcsens0040 | Meadow Pin |
---|---|
GND | GND |
TriggerOut | D05 |
VCC | 3V3 |