User Tools

Site Tools


en-us_commands:reference:irtcclearoscillatorstopflag

This is an old revision of the document!


IrtcClearOscillatorStopFlag()

IrtcClearOscillatorStopFlag() clears the oscillator-stop status flag.

IrtcClearOscillatorStopFlag command operation flow

bool IrtcClearOscillatorStopFlag()

Commands

Command Arguments Return Value Operation
IrtcClearOscillatorStopFlag() None bool Clears the oscillator-stop status flag.

Example

void setup() {
  Serial.begin(115200);
  if (!IrtcBegin()) return;  // Check the DS3231 RTC connection and begin operation.
 
  bool valid = false;
  if (IrtcTimeValid(valid) && !valid) {  // Check whether the RTC time is reliable.
    IrtcSet(2026, 9, 7, 9, 0, 0);  // Set the RTC date and time.
    IrtcClearOscillatorStopFlag();  // Clear the oscillator-stop flag.
  }
}
 
void loop() {
  IrtcDateTime now;
  uint32_t unixTime = 0;
  float rtcTemperature = 0.0F;
  if (IrtcRead(now) && IrtcUnixTime(unixTime) && IrtcGetTemperature(rtcTemperature)) {  // Return the RTC's internal temperature. / Return the current time as Unix time. / Read the RTC date and time.
    Serial.print(unixTime); Serial.print(','); Serial.println(rtcTemperature, 2);
  }
  delay(1000);
}

Precautions

Run each device's corresponding Begin command first. Check I²C addresses and pin sharing; if the bool return value is false, inspect wiring and power.

← Built-in Command List

en-us_commands/reference/irtcclearoscillatorstopflag.1788791734.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki