Reference
Last revision 2025/12/19
This guide offers an in-depth reference to the DS323X Library, including API details for managing time and temperature on Arduino. It covers library installation, usage of various functions for date, time retrieval, and setting, plus supplementary resources like the DS3231 datasheet.
API Description
/*!
*@brief get year of now time
*@return year
*/
uint16_t getYear();
/*!
*@brief get month of now time
*@return month
*/
uint8_t getMonth();
/*!
*@brief get date of now time
*@return date
*/
uint8_t getDate();
/*!
*@brief get hour of now time
*@return hour
*/
uint8_t getHour();
/*!
*@brief get minute of now time
*@return minute
*/
uint8_t getMinute();
/*!
*@brief get second of now time
*@return second
*/
uint8_t getSecond();
/*!
*@brief get day of week
*@return day of week
*/
String getDayOfWeek();
/*!
*@brief Set hour system of time
*@param eHours_t:e24hours, e12hours. default is e24hours
*/
void setHourSystem(eHours_t mode = e24hours);
/*!
*@brief Set time into rtc and take effect immediately
*@param year, 1900~2100
*@param month, 1~12
*@param date, 1~31
*@param hour, 0~23
*@param minute, 0~59
*@param second, 0~59
*/
void setTime(uint16_t year, uint8_t month, uint8_t date, uint8_t hour, uint8_t minute, uint8_t second);
/*!
*@brief Set the last compiled time as the current time
*@param comSec, Compensation time, the value obtained by subtracting the PC system time from the serial port printing time after
*/the first upload,unit: s.
void getCompileTime(uint8_t comSec);
/*!
*@brief output AM or PM of time
*@return AM or PM, 24hours return empty string
*/
String getAMorPM();
/*!
*@brief Get current temperature
*@return Current temperautre, unit: ℃
*/
float getTemperatureC();
/*!
*@brief Judge if it is power-down
*@return True means rtc lost power before and need to reset time;False means rtc operates well
*/
bool isLostPower(void);
Was this article helpful?
