Skip to content

begin()

Arnd edited this page Jun 30, 2018 · 2 revisions

begin([I2CSpeed]);

This function must be called to initialize the DS3231M. The optional boolean return value is set to false if the DS3231M is not detected otherwise it returns true.

By default the bus speed speed is 100KHz ("I2C_STANDARD_MODE") but optionally the speed can be increased to 400KHz using the optional "I2CSpeed" parameter value of "I2C_FAST_MODE".


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 1 second.");
    delay(1000);
  } // of loop until device is located
...
} // of setup
Clone this wiki locally