nanoFramework.Iot.Device.Rtc 1.2.613

前缀已保存
dotnet add package nanoFramework.Iot.Device.Rtc --version 1.2.613                
NuGet\Install-Package nanoFramework.Iot.Device.Rtc -Version 1.2.613                
此命令旨在在 Visual Studio 的包管理器控制台内使用,因为它使用了 NuGet 模块的 Install-Package 版本。
<PackageReference Include="nanoFramework.Iot.Device.Rtc" Version="1.2.613" />                
对于支持 PackageReference 的项目,请将此 XML 节点复制到项目文件中以引用软件包。
paket add nanoFramework.Iot.Device.Rtc --version 1.2.613                
#r "nuget: nanoFramework.Iot.Device.Rtc, 1.2.613"                
#r 指令可用于 F# Interactive 和 Polyglot Notebooks。将其复制到交互工具或脚本源代码中以引用软件包。
// Install nanoFramework.Iot.Device.Rtc as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Rtc&version=1.2.613

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

实时时钟

项目支持以下 RTC 设备:DS1307、DS3231、PCF8563(或兼容 BM8563)。

文档

板型

Circuit RTC

用法

重要:在创建 I2cDevice 之前,请确保正确设置了 I2C 引脚,特别是 ESP32 的 I2C 引脚,并确保已安装 nanoFramework.Hardware.ESP32 NuGet。

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);

对于 STM32 等其他设备,请确保您正在使用预设的 I2C 总线引脚。

所需的硬件

  • DS1307/DS3231/PCF8563/BM8563
  • 公/母跳线
using System.Device.I2c;
using Iot.Device.Rtc;
using nanoFramework.Hardware.Esp32;

// The I2C pins 21 and 22 in the sample below are ESP32 specific and may differ from other platforms.
// Please double check your device datasheet.
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);

I2cConnectionSettings settings = new I2cConnectionSettings(1, Pcf8563.DefaultI2cAddress);
I2cDevice device = I2cDevice.Create(settings);

using (Pcf8563 rtc = new Pcf8563(device))
{
    // set Pcf8563 dateTime
    // rtc.DateTime = GetDateTimeFromInternet();
    rtc.DateTime = new DateTime(2021, 9, 8, 10, 11, 12);
    
    while (true)
    {
        // read time
        DateTime dt = rtc.DateTime;
        
        // output the current time
        Debug.WriteLine($"Time: {dt.ToString("yyyy/MM/dd HH:mm:ss")}");
        
        // wait for a second
        Thread.Sleep(1000);
    }
}

结果

Sample result

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

NuGet 包 (4)

显示依赖 nanoFramework.Iot.Device.Rtc 的前 4 个 NuGet 包

下载
nanoFramework.M5Core2

此包包含 nanoFramework.M5Core2 归档,适用于 .NET nanoFramework C# 项目。

nanoFramework.M5StickC

此包包含 nanoFramework.M5StickC 归档,适用于 .NET nanoFramework C# 项目。

nanoFramework.M5 StickC Plus

此包包含 nanoFramework.M5 StickC Plus 归档,适用于 .NET nanoFramework C# 项目。

nanoFramework.Tough

此包包含 nanoFramework.Tough 归档,适用于 .NET nanoFramework C# 项目。

GitHub 代码库 (1)

显示依赖 nanoFramework.Iot.Device.Rtc 的最热门的前 1 个 GitHub 代码库

代码库 星级
nanoframework/nanoFramework.IoT.Device
📦 此代码库包含各种传感器、芯片、显示屏、帽子和驱动程序的 .NET nanoFramework 实现
版本 下载 最后更新
1.2.613 75 8/9/2024
1.2.601 138 7/26/2024
1.2.590 275 7/17/2024
1.2.573 524 6/19/2024
1.2.570 86 6/14/2024
1.2.536 769 4/15/2024
1.2.514 558 3/22/2024
1.2.506 241 3/5/2024
1.2.494 218 2/28/2024
1.2.478 348 1/26/2024
1.2.462 424 1/5/2024
1.2.458 201 12/20/2023
1.2.436 609 11/10/2023
1.2.416 344 11/8/2023
1.2.403 516 10/6/2023
1.2.396 345 9/27/2023
1.2.384 388 9/6/2023
1.2.378 563 8/16/2023
1.2.369 504 8/2/2023
1.2.363 308 7/28/2023
1.2.357 376 7/19/2023
1.2.354 341 7/14/2023
1.2.345 600 6/21/2023
1.2.341 387 6/14/2023
1.2.337 398 6/7/2023
1.2.335 188 6/2/2023
1.2.329 562 5/26/2023
1.2.313 643 5/12/2023
1.2.302 499 5/10/2023
1.2.297 452 5/3/2023
1.2.273 1,927 3/17/2023
1.2.267 1,059 3/10/2023
1.2.263 926 3/8/2023
1.2.259 991 2/27/2023
1.2.256 788 2/24/2023
1.2.253 785 2/22/2023
1.2.222 2,008 1/9/2023
1.2.212 2,624 1/5/2023
1.2.208 421 1/3/2023
1.2.203 1,226 12/28/2022
1.2.153 3,862 11/5/2022
1.2.141 3,792 10/25/2022
1.2.125 1,545 10/12/2022
1.2.87 9,995 9/15/2022
1.2.68 2,563 9/5/2022
1.2.63 1,475 9/3/2022
1.2.47 1,603 8/15/2022
1.2.40 1,840 8/6/2022
1.2.38 1,561 8/5/2022
1.2.28 4,640 8/1/2022
1.2.13 3,751 7/24/2022
1.2.10 1,609 7/23/2022
1.1.142.3202 3,975 7/7/2022
1.1.133.52556 4,868 6/30/2022
1.1.121.35854 3,713 6/26/2022
1.1.116.8772 2,647 6/24/2022
1.1.113.2032 475 6/23/2022
1.1.102.51394 2,774 6/15/2022
1.1.99.36719 1,539 6/14/2022
1.1.72.29765 8,725 5/31/2022
1.1.61.27737 3,966 5/25/2022
1.1.58.10097 1,354 5/23/2022
1.1.54.28879 1,350 5/23/2022
1.1.40 3,991 5/5/2022
1.1.3 12,423 4/15/2022
1.1.1 451 4/14/2022
1.0.303 1,366 4/12/2022
1.0.302 4,459 3/31/2022
1.0.288-preview.114 146 3/25/2022
1.0.288-preview.113 119 3/25/2022
1.0.288-preview.112 131 3/25/2022
1.0.288-preview.103 131 3/21/2022
1.0.288-preview.100 130 3/19/2022
1.0.288-preview.96 156 3/16/2022
1.0.288-preview.86 195 3/8/2022
1.0.288-preview.77 158 2/27/2022
1.0.288-preview.75 123 2/26/2022
1.0.288-preview.69 140 2/18/2022
1.0.288-preview.63 139 2/16/2022
1.0.288-preview.61 131 2/12/2022
1.0.288-preview.58 126 2/10/2022
1.0.288-preview.53 120 2/9/2022
1.0.288-preview.41 168 1/31/2022
1.0.288-preview.22 245 1/27/2022
1.0.288-preview.20 142 1/27/2022
1.0.288-preview.18 150 1/27/2022
1.0.288-preview.5 164 1/24/2022
1.0.272 604 1/10/2022
1.0.260 936 12/10/2021
1.0.259 344 12/9/2021
1.0.258 315 12/7/2021
1.0.225 518 10/22/2021
1.0.165 412 9/10/2021
1.0.157 363 9/4/2021
1.0.155 367 8/31/2021
1.0.153 361 8/14/2021
1.0.151 379 8/6/2021
1.0.146 366 7/22/2021
1.0.136 425 7/17/2021
1.0.134 183 7/15/2021
1.0.133 193 7/14/2021
1.0.130 199 7/6/2021
1.0.129 173 7/6/2021
1.0.127 182 7/5/2021
1.0.125 203 7/5/2021
1.0.122 218 6/30/2021
1.0.121 202 6/29/2021
1.0.119 227 6/28/2021
1.0.111 188 6/14/2021
1.0.105 286 5/29/2021
1.0.104 256 5/29/2021
1.0.97 178 5/28/2021
1.0.67 201 5/26/2021