Skip to content

begin()

Arnd edited this page Dec 12, 2020 · 3 revisions

begin([I2CSpeed]);

This function must be called to initialize the DS1631 class. The DS1631 can have one of up to 8 different addresses and the library supports up to all 8 addresses being used. The optional boolean return value is set to false if no DS1631 is not detected otherwise it returns the number of thermometers detected. This number can also be retrieved with thermometers.

The optional "I2CSpeed" parameter defaults to a bus speed of 100KHz ("I2C_STANDARD_MODE") but can also be raised to 400KHz by passing the constant "I2C_FAST_MODE".


Example:

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