0

This was supposed to be the code for automatic pet feeder Got it from here1

The problem is that I always got a "No matching function for call to'DS3231 (const uint8_t &, const uint8_t &)"

Here's the error code

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"





















ANA_FEEDER_PROJECT:53:18: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

 DS3231 rtc(A4, A5);

                  ^

In file included from C:\Users\SERIES\Desktop\ANA_FEEDER_PROJECT\ANA_FEEDER_PROJECT.ino:1:0:

D:\Documents\Arduino\libraries\DS3231/DS3231.h:67:3: note: candidate: DS3231::DS3231(TwoWire&)

   DS3231(TwoWire & w);

   ^~~~~~

D:\Documents\Arduino\libraries\DS3231/DS3231.h:67:3: note:   candidate expects 1 argument, 2 provided

D:\Documents\Arduino\libraries\DS3231/DS3231.h:66:3: note: candidate: DS3231::DS3231()

   DS3231();

   ^~~~~~

D:\Documents\Arduino\libraries\DS3231/DS3231.h:66:3: note:   candidate expects 0 arguments, 2 provided

D:\Documents\Arduino\libraries\DS3231/DS3231.h:62:7: note: candidate: constexpr DS3231::DS3231(const DS3231&)

 class DS3231 {

       ^~~~~~

D:\Documents\Arduino\libraries\DS3231/DS3231.h:62:7: note:   candidate expects 1 argument, 2 provided

D:\Documents\Arduino\libraries\DS3231/DS3231.h:62:7: note: candidate: constexpr DS3231::DS3231(DS3231&&)

D:\Documents\Arduino\libraries\DS3231/DS3231.h:62:7: note:   candidate expects 1 argument, 2 provided

C:\Users\SERIES\Desktop\ANA_FEEDER_PROJECT\ANA_FEEDER_PROJECT.ino: In function 'void setup()':

ANA_FEEDER_PROJECT:84:7: error: 'class DS3231' has no member named 'begin'

   rtc.begin();

       ^~~~~

C:\Users\SERIES\Desktop\ANA_FEEDER_PROJECT\ANA_FEEDER_PROJECT.ino: In function 'void loop()':

ANA_FEEDER_PROJECT:130:10: error: 'class DS3231' has no member named 'getTimeStr'; did you mean 'getMinute'?

  t = rtc.getTimeStr();

          ^~~~~~~~~~

          getMinute

ANA_FEEDER_PROJECT:146:16: error: 'class DS3231' has no member named 'getTimeStr'; did you mean 'getMinute'?

  lcd.print(rtc.getTimeStr());

                ^~~~~~~~~~

                getMinute

ANA_FEEDER_PROJECT:152:16: error: 'class DS3231' has no member named 'getDateStr'; did you mean 'getDate'?

  lcd.print(rtc.getDateStr());

                ^~~~~~~~~~

                getDate

exit status 1

no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The problem is that I always got a "No matching function for call to'DS3231 (const uint8_t &, const uint8_t &)"

Here's the error code

1
  • please read what you wrote ... there is no reason to repeat sentences
    – jsotola
    Oct 22, 2022 at 20:01

1 Answer 1

3

You are using the wrong DS3231 library. Unfortunately, you can often find incompatible libraries that share the same name. The sketch you downloaded has been written for a specific version of the DS3231 library. Thus your choices are:

  • either you use that specific version (linked to in the page you gave as reference)
  • or you adapt the code to work with the version you have installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.