-
Notifications
You must be signed in to change notification settings - Fork 5
Class: RTCPi
This class contains methods for use with the RTC Pi, RTC Pi Plus and RTC Pi Zero from https://www.abelectronics.co.uk/p/52/RTC-Pi-Plus
https://www.abelectronics.co.uk/p/70/RTC-Pi-Zero
Connect()
Connect to the I2C device
Parameters: none
Returns: null
IsConnected()
Check if the device is connected
Parameters: none
Returns: boolean
Dispose()
Dispose of the active I2C device
Parameters: none
Returns: null
SetDate(DateTime date)
Set the date and time on the RTC
Parameters: date as DateTime
Returns: null
ReadDate()
Returns the date from the RTC in ISO 8601 format - YYYY-MM-DDTHH:MM:SS
Returns: date as DateTime
EnableOutput()
Enable the square-wave output on the SQW pin.
Returns: null
DisableOutput()
Disable the square-wave output on the SQW pin.
Returns: null
SetFrequency(byte frequency)
Set the frequency for the square-wave output on the SQW pin.
Parameters: frequency - options are: 1 = 1Hz, 2 = 4.096KHz, 3 = 8.192KHz, 4 = 32.768KHz
Returns: null
To use the RTC Pi library in your code you must first import the library dll:
using ABElectronics_Win10IOT_Libraries;
Next you must initialise the rtc class:
ABElectronics_Win10IOT_Libraries.RTCPi rtc = new ABElectronics_Win10IOT_Libraries.RTCPi();
Next we need to connect to the device and wait for the connection
rtc.Connect();
while (!rtc.IsConnected)
{
}
You can set the date and time from the RTC chip to be the 25th December 2015 at 6 AM with:
DateTime newdate = new DateTime(2015, 12, 25, 06, 00, 00);
rtc.SetDate(newdate);
You can read the date and time from the RTC chip with:
DateTime value = rtc.ReadDate();