Skip to content

Class Instantiation

Arnd edited this page Dec 12, 2020 · 2 revisions

The DS3231M class has no parameters. It uses I2C where the 2 pins are predefined and the DS3231M has a fixed I2C address. Instantiating the class does not check to see if the DS3231M is present, that is done as part of the begin() method.


Example:

DS3231M_Class DS3231M; // Create an instance of the DS3231M
...
void setup() {
  Serial.begin(SERIAL_SPEED);
  while (!DS3231M.begin()) { // Initialize RTC communications
    Serial.println("Unable to find DS3231M. Checking again in 3 seconds.");
    delay(3000);
  } // of loop until device is located
...
} // of setup
Clone this wiki locally