Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.03 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.03 KB

Realtime Clock

The RTC devices supported by the project include DS1307, DS3231, PCF8563.

Documentation

Board

Circuit DS1307

Usage

Hardware Required

  • DS1307/DS3231/PCF8563
  • Male/Female Jumper Wires
I2cConnectionSettings settings = new I2cConnectionSettings(1, Ds1307.DefaultI2cAddress);
I2cDevice device = I2cDevice.Create(settings);

using (Ds1307 rtc = new Ds1307(device))
{
    // set DS1307 time
    rtc.DateTime = DateTime.Now;

    // loop
    while (true)
    {
        // read time
        DateTime dt = rtc.DateTime;

        Console.WriteLine($"Time: {dt.ToString("yyyy/MM/dd HH:mm:ss")}");
        Console.WriteLine();

        // wait for a second
        Thread.Sleep(1000);
    }
}

Result

Sample result