Skip to main content

Meadow.Foundation.RTCs.Pcf8523

Pcf8523
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.RTCs.Pcf8523

Code Example

privatePcf8523 rtc;

publicoverrideTaskInitialize()
{
Resolver.Log.Info("Initializing...");

rtc =newPcf8523(Device.CreateI2cBus());

returnbase.Initialize();
}

publicoverrideTaskRun()
{
var dateTime =newDateTimeOffset();
var running = rtc.IsRunning;

Resolver.Log.Info($"{(running ?"is running":"is not running")}");

if(!running)
{
Resolver.Log.Info(" Starting RTC...");
rtc.IsRunning =true;
}

dateTime = rtc.GetTime();
Resolver.Log.Info($" RTC current time is: {dateTime.ToString("MM/dd/yy HH:mm:ss")}");

Resolver.Log.Info($" Setting RTC to : {dateTime.ToString("MM/dd/yy HH:mm:ss")}");
dateTime =newDateTime(2030,2,15);
rtc.SetTime(dateTime);

dateTime = rtc.GetTime();
Resolver.Log.Info($" RTC current time is: {dateTime.ToString("MM/dd/yy HH:mm:ss")}");

returnbase.Run();
}

Sample project(s) available on GitHub

close