How to get code to respond to a certain time from the DS3231 RTC? I am trying to make a program that runs when it gets to five in the afternoon, so 17:00:00.

I am using this DS3231 library, but I can't figure out a way to get it to send "Woooopp" to the serial monitor at the specified time.

On the DS3231, the pin labeled SCL is connected to A5 on the Arduino and the pin labeled SDA is connected to A4 on the Arduino.

SCL -> A5
SDA -> A4 

My code:

#include &lt;DS3231.h&gt;

// Init the DS3231 using the hardware interface
DS3231  rtc (SDA, SCL);

void setup() {
  // Setup Serial connection
  Serial.begin(115200);
  // Uncomment the next line if you are using an Arduino Leonardo
  //while (!Serial) {}

  // Initialize the rtc object
  rtc.begin();

  // The following lines can be uncommented to set the date and time
  // rtc.setDOW(SATURDAY);     // Set Day-of-Week to SUNDAY
  // rtc.setTime(19, 48, 50);     // Set the time to 12:00:00 (24hr format)
  // rtc.setDate(3, 6, 2017);   // Set the date to January 1st, 2014
}

void loop() {
  // Send Day-of-Week
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");

  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  // Send time
  Serial.println(rtc.getTimeStr());

  // Wait one second before repeating :)

  if (rtc.getTimeStr() == "19:58:12") {
    Serial.println("Woooopp");
  }
  delay (1000);
}


No errors are thrown, however, the code simply does not work.

Any help would be greatly appreciated!
How to get code to respond to a certain time from the DS3231 RTC?


the easiest is to set up the alarm in rtc.

alternatively, keep reading the rtc until the desired time has passed. not terribly efficient.