Skip to content

deviceStatus()

Arnd edited this page Dec 11, 2020 · 5 revisions

Returns a boolean value set to true when the oscillator is turned on 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 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");
...
} // of setup
Clone this wiki locally