ESP32 Display Controller and Graphics Library
DS3231 Class Reference

DS3231 Real Time Clock driver. More...

#include <DS3231.h>

Public Member Functions

bool available ()
 Determines if DS3231 is reachable. More...
void begin (I2C *i2c)
 Initializes DS3231 driver. More...
void clockEnabled (bool value)
 Enables or disables DS3231 oscillator. More...
DateTime const & datetime ()
 Queries DS3231 for current date and time. More...
bool dateTimeValid ()
 Determines the validity of datetime. More...
bool setDateTime (DateTime const &value)
 Sets current date and time. More...
double temperature ()
 Forces DS3231 to read current temperature. More...

Detailed Description

DS3231 Real Time Clock driver.


fabgl::I2C    I2C;
fabgl::DS3231 DS3231;

void setup() {
  I2C.begin(GPIO_NUM_4, GPIO_NUM_15);  // 4 = SDA, 15 = SCL (WARN: disconnect VGA connector!!)

  auto dt = DS3231.datetime();
  Serial.printf("%02d/%02d/%d  %02d:%02d:%02d\n", dt.dayOfMonth, dt.month, dt.year, dt.hours, dt.minutes, dt.seconds);
  Serial.printf("temp = %0.3f C\n", DS3231.temperature());

Definition at line 102 of file DS3231.h.

The documentation for this class was generated from the following files: