DS3231 Alarms Trouble... HELP!

byte in15Minutes(DS3231& rtc) {
  RTCDateTime now = rtc.getDateTime();
  return (now.minute + 15) % 60;
}


 void setAlarm2(uint8_t dydw, uint8_t hour, uint8_t minute, DS3231_alarm2_t mode, bool armed = true);
 setAlarm2(0, 0, computedMinutes, DS3231_MATCH_M);

Ok i've removed the function in a function causing that problem but i've just been hit with another error code..

expected constructor, destructor, or type conversion before '(' token

up until setting the alarm i understood what I was doing but now i just feel like its gone over my head... :confused:

Have you noticed that the compiler also lists a line number with the error code? Recent IDE's also highlight the error line.

This is a function prototype:

 void setAlarm2(uint8_t dydw, uint8_t hour, uint8_t minute, DS3231_alarm2_t mode, bool armed = true);

It is a function definition that has no "body".

I'm starting to lean towards reply #17, you seem to be programming by trial and error. That's fine, but you shouldn't expect much help doing it.

The way to learn is to find tasks that are challenging, but not beyond your capabilities. When you build a house, you begin with a foundation. Else the walls will crumble. The roof won't stand up without walls. So you have to firm things up as you go before you can make a big project.

This is an example for an alarm all 15 minutes (the “alarm all 15 seconds” is commented out.)

#include <Wire.h>
#include <DS3231.h>              //https://github.com/jarzebski/Arduino-DS3231

DS3231 clock;
RTCDateTime cTime;

volatile bool alarmFired = false;

void handleAlarm() {
  alarmFired = true;
}

byte in15Minutes() {
  cTime = clock.getDateTime();
  return (cTime.minute + 15) % 60;
}

//byte in15Seconds() {
//  cTime = clock.getDateTime();
//  return (cTime.second + 15) % 60;
//}

void setup() {
  Serial.begin(115200);
  attachInterrupt(digitalPinToInterrupt(2), handleAlarm, FALLING);
  clock.begin();
  clock.armAlarm1(false);
  clock.armAlarm2(false);
  clock.clearAlarm1();
  clock.clearAlarm2();
  cTime = clock.getDateTime();
  Serial.println(clock.dateFormat("d-m-Y H:i:s", cTime));
  //  clock.setAlarm1(0, 0, 0, in15Seconds(), DS3231_MATCH_S);
  clock.setAlarm2(0, 0, in15Minutes(), DS3231_MATCH_M);
  Serial.print(F(" alarm on minute "));
  Serial.println(in15Minutes());
}

void loop() {
  if (alarmFired) {
    //    if (clock.isAlarm1()) {
    //      byte in15s = in15Seconds();
    //      Serial.print(F(" next on sec "));
    //      Serial.println(in15s);
    //      clock.setAlarm1(0, 0, 0, in15s, DS3231_MATCH_S);
    //    }
    if (clock.isAlarm2()) {
      byte in15m = in15Minutes();
      Serial.print(F(" next on min "));
      Serial.println(in15m);
      clock.setAlarm2(0, 0, in15m, DS3231_MATCH_M);
    }
    alarmFired = false;
  }
}