nanoFramework.Iot.Device.Ds1621 1.0.555
前缀已保留
dotnet add package nanoFramework.Iot.Device.Ds1621 --version 1.0.555
NuGet\Install-Package nanoFramework.Iot.Device.Ds1621 -Version 1.0.555
此命令旨在在Visual Studio的包管理器控制台内使用,因为它使用了NuGet模块的Install-Package版本。
<PackageReference Include="nanoFramework.Iot.Device.Ds1621" Version="1.0.555" />
对于支持PackageReference的项目,请将此XML节点复制到项目文件中以便引用该包。
paket add nanoFramework.Iot.Device.Ds1621 --version 1.0.555
NuGet团队不提供对此客户端的支持。请联系其维护者以获取支持。
#r "nuget: nanoFramework.Iot.Device.Ds1621, 1.0.555"
#r指令可以在F# Interactive和Polyglot Notebooks中使用。将其复制到交互式工具或脚本的源代码中以便引用该包。
// Install nanoFramework.Iot.Device.Ds1621 as a Cake Addin #addin nuget:?package=nanoFramework.Iot.Device.Ds1621&version=1.0.555 // Install nanoFramework.Iot.Device.Ds1621 as a Cake Tool #tool nuget:?package=nanoFramework.Iot.Device.Ds1621&version=1.0.555
NuGet团队不提供对此客户端的支持。请联系其维护者以获取支持。
Ds1621 - 1-Wire 数字温度计,具有可编程分辨率
Ds1621数字温度计提供9位到12位的摄氏度温度测量,并具有带有非易失性用户可编程的上限和下限触发点的报警功能。
文档
原始代码是为ESP32编写的
用法
重要:在创建I2cDevice
之前,请确保正确设置ESP32的I2C引脚。为此,请安装nanoFramework.Hardware.Esp32
NuGet,并使用Configuration
类配置引脚。
// When connecting to an ESP32 device you will need to configure the I2C GPIOs used for the bus.
Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(Gpio.IO22, DeviceFunction.I2C1_CLOCK);
对于STM32等其他设备,请确保您正在使用您要使用的I2C总线的预设引脚。
以下示例演示了使用Ds1621的温度和报警功能。
using System;
using System.Device.I2c;
using System.Diagnostics;
using System.Threading;
using Iot.Device.Ds1621;
using nanoFramework.Hardware.Esp32;
using UnitsNet;
string alarmState;
// Setup ESP32 I2C port.
Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(Gpio.IO22, DeviceFunction.I2C1_CLOCK);
// Setup Ds1621 device.
I2cConnectionSettings i2cSettings = new I2cConnectionSettings(1, Ds1621.DefaultI2cAddress);
I2cDevice i2cDevice = new I2cDevice(i2cSettings);
Ds1621 thermometer = new Ds1621(i2cDevice, MeasurementMode.Single);
// Set temperature alarms.
thermometer.LowTemperatureAlarm = Temperature.FromDegreesFahrenheit(65);
thermometer.HighTemperatureAlarm = Temperature.FromDegreesFahrenheit(80);
while (true)
{
// Start temperature conversion.
thermometer.MeasureTemperature();
// Wait for temperature conversion to complete.
while (thermometer.IsMeasuringTemperature)
{
Thread.Sleep(10);
}
Temperature temperature = thermometer.GetTemperature();
// Check temperature alarm states.
if (thermometer.HasLowTemperatureAlarm)
{
alarmState = "[Low Temperature]";
}
else if (thermometer.HasHighTemperatureAlarm)
{
alarmState = "[High Temperature]";
}
else
{
alarmState = string.Empty;
}
Debug.WriteLine($"{DateTime.UtcNow} : {temperature.DegreesCelsius:F1}�C / {temperature.DegreesFahrenheit:F1}�F {alarmState}");
Thread.Sleep(1000);
}
产品 | 版本 兼容和附加计算的目标框架版本。 |
---|---|
.NET Framework | net 是兼容的。 |
-
- nanoFramework.CoreLibrary (>= 1.15.5)
- nanoFramework.System.Device.Gpio (>= 1.1.41)
- nanoFramework.System.Device.I2c (>= 1.1.16)
- nanoFramework.System.Math (>= 1.5.43)
- UnitsNet.nanoFramework.Temperature (>= 5.56.0)
NuGet 包
此包没有被任何 NuGet 包使用。
GitHub 仓库
此包没有被任何流行的 GitHub 仓库使用。
版本 | 下载 | 最后更新 |
---|---|---|
1.0.555 | 56 | 8/9/2024 |
1.0.543 | 47 | 7/26/2024 |
1.0.537 | 58 | 7/24/2024 |
1.0.532 | 69 | 7/17/2024 |
1.0.515 | 82 | 6/19/2024 |
1.0.512 | 84 | 6/14/2024 |
1.0.502 | 88 | 5/29/2024 |
1.0.494 | 81 | 5/17/2024 |
1.0.490 | 59 | 5/15/2024 |
1.0.478 | 104 | 4/15/2024 |
1.0.456 | 101 | 3/22/2024 |
1.0.436 | 97 | 2/28/2024 |
1.0.416 | 114 | 1/24/2024 |
1.0.404 | 139 | 1/5/2024 |
1.0.400 | 126 | 12/20/2023 |
1.0.378 | 146 | 11/10/2023 |
1.0.345 | 130 | 10/6/2023 |
1.0.338 | 116 | 9/27/2023 |
1.0.326 | 120 | 9/6/2023 |
1.0.320 | 134 | 8/16/2023 |
1.0.311 | 139 | 8/2/2023 |
1.0.305 | 131 | 7/28/2023 |
1.0.299 | 142 | 7/19/2023 |
1.0.296 | 130 | 7/14/2023 |
1.0.287 | 127 | 6/21/2023 |
1.0.283 | 125 | 6/14/2023 |
1.0.279 | 127 | 6/7/2023 |
1.0.277 | 119 | 6/2/2023 |
1.0.271 | 121 | 5/26/2023 |
1.0.255 | 119 | 5/12/2023 |
1.0.250 | 121 | 5/11/2023 |
1.0.244 | 127 | 5/10/2023 |
1.0.239 | 131 | 5/3/2023 |
1.0.215 | 202 | 3/17/2023 |
1.0.209 | 212 | 3/10/2023 |
1.0.205 | 208 | 3/8/2023 |
1.0.201 | 211 | 2/27/2023 |
1.0.198 | 217 | 2/24/2023 |
1.0.195 | 235 | 2/22/2023 |
1.0.164 | 273 | 1/9/2023 |
1.0.154 | 286 | 1/5/2023 |
1.0.150 | 290 | 1/3/2023 |
1.0.145 | 277 | 12/28/2022 |
1.0.95 | 350 | 11/5/2022 |
1.0.83 | 359 | 10/25/2022 |
1.0.70 | 358 | 10/22/2022 |
1.0.64 | 396 | 10/12/2022 |
1.0.56 | 357 | 10/8/2022 |
1.0.37 | 398 | 9/22/2022 |
1.0.29 | 450 | 9/15/2022 |
1.0.15 | 377 | 9/8/2022 |
1.0.5 | 384 | 9/3/2022 |
1.0.3 | 370 | 8/27/2022 |
1.0.1 | 370 | 8/26/2022 |