Skip to content

deviceStatus()

Arnd edited this page Jul 23, 2017 · 5 revisions

deviceStatus();

This function returns a boolean value, it is set to true when the oscillator is turned off and returns false when the oscillator is turned off or otherwise not running. By default the MCP7940 is turned off on power-up and the oscillator must explicitly be turned on to start the RTC. This is done using either deviceStart() or setting the time using the adjust().


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
  Serial.print("The oscillator is turned ");
  if(MCP7940.deviceStatus) Serial.println("ON"); else Serial.println("OFF");
...
Clone this wiki locally