Skip to content

Class Instantiation

Arnd edited this page Jul 23, 2017 · 4 revisions

MC7940;

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


Example:

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