nanoFramework.Iot.Device.Hcsr501 1.2.590

前缀已保留
dotnet add package nanoFramework.Iot.Device.Hcsr501 --version 1.2.590                
NuGet\Install-Package nanoFramework.Iot.Device.Hcsr501 -Version 1.2.590                
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.590" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Hcsr501 --version 1.2.590                
#r "nuget: nanoFramework.Iot.Device.Hcsr501, 1.2.590"                
#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.
// Install nanoFramework.Iot.Device.Hcsr501 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Hcsr501&version=1.2.590

// Install nanoFramework.Iot.Device.Hcsr501 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Hcsr501&version=1.2.590                

HC-SR501 - 红外热感应移动物体传感器

HC-SR501用于检测周围环境中的红外热量以实现运动检测。

文档

sensor

用法

using(Hcsr501 sensor = new Hcsr501(hcsr501Pin, PinNumberingScheme.Logical))
{
    // detect motion
    bool isDetected = sensor.IsMotionDetected;
}

HC-SR501 示例,我们可以做更多完整的事情

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);
    }
}

硬件要求

  • 红外热感应移动物体传感器 - HC-SR501
  • LED
  • 220 欧姆电阻器
  • 公母跳线

电路

circuit

HC-SR501

settings

  • VCC - 5V
  • GND - GND
  • OUT - GPIO 17

LED

  • VCC & 220 欧姆电阻器 - GPIO 27
  • GND - GND

结果

result

产品 兼容和额外计算的框架版本。
.NET Framework net is compatible. 
兼容目标框架
包含目标框架(在包中)
了解关于目标框架.NET Standard的更多信息。

NuGet包

该包没有被任何NuGet包使用。

GitHub仓库

该包没有被任何流行的GitHub仓库使用。

版本 下载 最后更新
1.2.590 71 7/17/2024
1.2.570 75 6/14/2024
1.2.560 84 5/29/2024
1.2.548 63 5/15/2024
1.2.436 276 11/10/2023
1.2.416 112 11/8/2023
1.2.329 200 5/26/2023
1.2.313 160 5/12/2023
1.2.297 179 5/3/2023
1.2.217 351 1/6/2023
1.2.203 322 12/28/2022
1.2.159 398 11/14/2022
1.2.153 400 11/5/2022
1.2.141 419 10/25/2022
1.2.122 455 10/12/2022
1.2.114 412 10/8/2022
1.2.95 452 9/22/2022
1.2.87 516 9/15/2022
1.2.73 431 9/8/2022
1.1.116.8772 464 6/24/2022
1.1.113.2032 441 6/23/2022
1.1.58.10097 464 5/23/2022
1.1.3 481 4/15/2022
1.1.1 454 4/14/2022
1.0.300 463 3/31/2022
1.0.277-preview.126 116 3/25/2022
1.0.277-preview.125 109 3/25/2022
1.0.277-preview.112 104 3/19/2022
1.0.277-preview.110 104 3/18/2022
1.0.277-preview.105 109 3/15/2022
1.0.277-preview.99 113 3/10/2022
1.0.277-preview.98 113 3/8/2022
1.0.277-preview.77 105 2/18/2022
1.0.277-preview.41 121 1/28/2022
1.0.277-preview.32 129 1/27/2022
1.0.277-preview.17 125 1/24/2022
1.0.277-preview.15 115 1/21/2022
1.0.277-preview.13 121 1/21/2022
1.0.277-preview.1 124 1/11/2022
1.0.259 327 12/9/2021
1.0.218 190 10/18/2021
1.0.155 335 8/31/2021
1.0.135 356 7/16/2021
1.0.134 165 7/15/2021
1.0.133 174 7/14/2021
1.0.125 190 7/5/2021
1.0.121 196 6/29/2021
1.0.119 215 6/28/2021
1.0.105 264 5/29/2021
1.0.13 176 5/21/2021