nanoFramework.Iot.Device.Hcsr501
1.2.114
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Hcsr501 --version 1.2.114
NuGet\Install-Package nanoFramework.Iot.Device.Hcsr501 -Version 1.2.114
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Hcsr501" Version="1.2.114" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Hcsr501" Version="1.2.114" />
<PackageReference Include="nanoFramework.Iot.Device.Hcsr501" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Hcsr501 --version 1.2.114
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: nanoFramework.Iot.Device.Hcsr501, 1.2.114"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Hcsr501&version=1.2.114
#tool nuget:?package=nanoFramework.Iot.Device.Hcsr501&version=1.2.114
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HC-SR501 - PIR Motion Sensor
HC-SR501 is used to detect motion based on the infrared heat in the surrounding area.
Documentation
Usage
using(Hcsr501 sensor = new Hcsr501(hcsr501Pin, PinNumberingScheme.Logical))
{
// detect motion
bool isDetected = sensor.IsMotionDetected;
}
From the HC-SR501 sample, we can do comething more complete:
GpioController ledController = new GpioController();
ledController.OpenPin(27, PinMode.Output);
using (Iot.Device.Hcsr501.Hcsr501 sensor =
new Iot.Device.Hcsr501.Hcsr501(17))
{
while (true)
{
// adjusting the detection distance and time by rotating the potentiometer on the sensor
if (sensor.IsMotionDetected)
{
// turn the led on when the sensor detected infrared heat
ledController.Write(27, PinValue.High);
Debug.WriteLine("Detected! Turn the LED on.");
}
else
{
// turn the led off when the sensor undetected infrared heat
ledController.Write(27, PinValue.Low);
Debug.WriteLine("Undetected! Turn the LED off.");
}
Thread.Sleep(1000);
}
}
Hardware Required
- PIR Motion Sensor - HC-SR501
- LED
- 220 Ω resistor
- Male/Female Jumper Wires
Circuit
HC-SR501
- VCC - 5V
- GND - GND
- OUT - GPIO 17
LED
- VCC & 220 Ω resistor - GPIO 27
- GND - GND
Result
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- nanoFramework.CoreLibrary (>= 1.12.0)
- nanoFramework.Runtime.Events (>= 1.11.1)
- nanoFramework.System.Device.Gpio (>= 1.1.18)
- nanoFramework.System.Device.Model (>= 1.2.82)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.2.869 | 177 | 4/2/2025 |
1.2.864 | 172 | 4/2/2025 |
1.2.852 | 186 | 3/11/2025 |
1.2.822 | 127 | 2/26/2025 |
1.2.775 | 131 | 2/4/2025 |
1.2.772 | 126 | 2/4/2025 |
1.2.755 | 133 | 1/31/2025 |
1.2.737 | 112 | 1/13/2025 |
1.2.696 | 136 | 12/16/2024 |
1.2.673 | 148 | 10/23/2024 |
1.2.631 | 143 | 8/28/2024 |
1.2.590 | 142 | 7/17/2024 |
1.2.570 | 136 | 6/14/2024 |
1.2.560 | 144 | 5/29/2024 |
1.2.548 | 119 | 5/15/2024 |
1.2.436 | 317 | 11/10/2023 |
1.2.416 | 153 | 11/8/2023 |
1.2.329 | 257 | 5/26/2023 |
1.2.313 | 221 | 5/12/2023 |
1.2.297 | 246 | 5/3/2023 |
1.2.217 | 409 | 1/6/2023 |
1.2.203 | 381 | 12/28/2022 |
1.2.159 | 464 | 11/14/2022 |
1.2.153 | 458 | 11/5/2022 |
1.2.141 | 495 | 10/25/2022 |
1.2.122 | 518 | 10/12/2022 |
1.2.114 | 473 | 10/8/2022 |
1.2.95 | 517 | 9/22/2022 |
1.2.87 | 593 | 9/15/2022 |
1.2.73 | 504 | 9/8/2022 |
1.1.116.8772 | 536 | 6/24/2022 |
1.1.113.2032 | 523 | 6/23/2022 |
1.1.58.10097 | 535 | 5/23/2022 |
1.1.3 | 559 | 4/15/2022 |
1.1.1 | 529 | 4/14/2022 |
1.0.300 | 541 | 3/31/2022 |
1.0.277-preview.126 | 172 | 3/25/2022 |
1.0.277-preview.125 | 163 | 3/25/2022 |
1.0.277-preview.112 | 169 | 3/19/2022 |
1.0.277-preview.110 | 161 | 3/18/2022 |
1.0.277-preview.105 | 173 | 3/15/2022 |
1.0.277-preview.99 | 170 | 3/10/2022 |
1.0.277-preview.98 | 174 | 3/8/2022 |
1.0.277-preview.77 | 164 | 2/18/2022 |
1.0.277-preview.41 | 184 | 1/28/2022 |
1.0.277-preview.32 | 187 | 1/27/2022 |
1.0.277-preview.17 | 184 | 1/24/2022 |
1.0.277-preview.15 | 179 | 1/21/2022 |
1.0.277-preview.13 | 181 | 1/21/2022 |
1.0.277-preview.1 | 191 | 1/11/2022 |
1.0.259 | 409 | 12/9/2021 |
1.0.218 | 256 | 10/18/2021 |
1.0.155 | 411 | 8/31/2021 |
1.0.135 | 433 | 7/16/2021 |
1.0.134 | 233 | 7/15/2021 |
1.0.133 | 240 | 7/14/2021 |
1.0.125 | 258 | 7/5/2021 |
1.0.121 | 264 | 6/29/2021 |
1.0.119 | 287 | 6/28/2021 |
1.0.105 | 339 | 5/29/2021 |
1.0.13 | 247 | 5/21/2021 |