Arduino errors sthat I have faced and have made the whole situation difficult.

I have been working on a project about an automatic pet feeder using the arduino therefore C++. I faced many errors some of which were solved pretty easily. There is one though that persists and doesn't let me keep up. It mentions these below:

Arduino: 1.8.10 (Windows 10), Πλακέτα:"Arduino/Genuino Uno"

Sequential_blinking:34:19: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

DS3231 rtc(A4, A5);

I would appreciate it if you helped me.

P.S. , I use Windows. Thank you very much !

(email removed)

sketch_mar13a.ino (2.53 KB)

Where did you get the DS3231 library ?
There are several of them

We need to know the exact DS3231 library you are using, without knowing that no-one can tell you what the proper code would be. Did you get it from the library manager?

Now we can see the code beter:

#include <DS3231.h>
#include <Servo.h>
#include <LiquidCrystal.h>
#include <Keypad.h>

const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three columns

// Define the Keymap

char keys[ROWS][COLS] = {

  {'1','2','3','A'},

  {'4','5','6','B'},

  {'7','8','9','C'},

  {'*','0','#','D'}

};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.

byte rowPins[ROWS] = { 2, 3, 4, 5 };

// Connect keypad COL0, COL1 and COL2 to these Arduino pins.

byte colPins[COLS] = { 6, 7, 8, 9 };

//  Create the Keypad
  Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

DS3231  rtc(A4, A5);
Servo servo_test;      //initialize a servo object for the connected servo  
LiquidCrystal lcd(A0, A1, A2, 11, 12, 13); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)

 //int angle = 0;    
// int potentio = A0;      // initialize the A0analog pin for potentiometer
 int t1, t2, t3, t4, t5, t6;

 
boolean feed = true; // condition for alarm

 char key;
 int r[6];
 
 void setup() 
 { 
  servo_test.attach(10);   // attach the signal pin of servo to pin9 of arduino
  rtc.begin();
  lcd.begin(16,2);
  servo_test.write(55); 
  Serial.begin(9600);
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  
 } 
 
 void loop() 
 { 

lcd.setCursor(0,0);
int buttonPress;
buttonPress = digitalRead(A3);

if (buttonPress==1)
 setFeedingTime();
 

//Serial.println(buttonPress);

 lcd.print("Time:  ");
 String t = "";
 t = rtc.getTimeStr(); 
 t1 = t.charAt(0)-48;
 t2 = t.charAt(1)-48;
 t3 = t.charAt(3)-48;
 t4 = t.charAt(4)-48;
 t5 = t.charAt(6)-48;
 t6 = t.charAt(7)-48;
 
 lcd.print(rtc.getTimeStr());
 lcd.setCursor(0,1);
 lcd.print("Date: ");
 lcd.print(rtc.getDateStr());
 
 if (t1==r[0] && t2==r[1] && t3==r[2] && t4==r[3]&& t5<1 && t6<3 && feed==true)
 { 
  servo_test.write(100);                   //command to rotate the servo to the specified angle 
   delay(400);   
  servo_test.write(55); 
  feed=false;
 } 
 }       

void setFeedingTime()
{
  feed = true;
   int i=0;

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Set feeding Time");
  lcd.clear();
  lcd.print("HH:MM");
  lcd.setCursor(0,1);

  
  while(1){
    key = kpd.getKey();

    char j;
    
  if(key!=NO_KEY){
    
    lcd.setCursor(j,1);
    
    lcd.print(key);
    
    r[i] = key-48;
    i++;
    j++;

    if (j==2)
    {
      lcd.print(":"); j++;
    }
    delay(500);
  }

  if (key == 'D')
  {key=0; break; }
  }
}

I followed this when I did my clock:

Look at step 3.

DS3231 rtc(A4, A5); //conected to SDA & SCL in your project?

I still don't know where you got the RTC library or what version it is

Did you write that code yourself? If so why did you use

DS3231  rtc(A4, A5);

and

rtc.begin();

and

rtc.getTimeStr()

and

rtc.getDateStr()

These are not part of the DS3231 library. So if you wrote this code then you are wrong, please see the Examples that came with this library to see how to use it correctly.

If you randomly gathered this code from the internet, then you have to find out exactly what DS3231 library the writer of this code was using.

Thanks for caring, I actually downloaded the first library that I found available named as the one i used. When I searched for her again, I clicked on more info and came accross this site

Whatever RTC library you are using do the examples with it work ?
If so, then please post one here that works

No, I did not write that by myself, both the hardware and the software are just a project that I am trying to copy.

For info about the project check this

Ukhelibob if you mean whether I have tried any other project with it again or not, it is my first on both with this library and Ds3231. What is an example and how can I find one? Are there projects that I can test and see if they do the trick with my library. What Intel can u give me on that?

Also fnb I have plugged the cables the same way as he did

Christopher_Togias:
What is an example and how can I find one?

Most Arduino libraries come with example sketches that demonstrate how to use the library. After installing the NorthernWidget/DS3231 library, you will find the example sketches in the Arduino IDE's File > Examples > DS3231 menu.

Pert thank you for your assistance, arduino IDE's file is where exactly? In the app that is used for coding or at the website.? I found some examples at the website, what am I supposed to do with them?

Christopher_Togias:
For info about the project check this

Automatic Pet Feeder using Arduino

From that tutorial:

Arduino have default libraries for using the Servo motor and LCD 162 with it. But for using DS3231 RTC Module and 44 Matrix Keypad with the Arduino, you have to download and install the libraries. The download link for both the libraries is given below:

As has been explained, there are multiple DS3231 libraries and if you are using code someone else wrote then you need to be sure to use the library their code was written for. Fortunately in this case the author of the code clearly documented which library to use, you just need to follow the instructions. If you are writing your own code, then you can pick whichever library you like, study the examples, and then write your code for that specific library.

Christopher_Togias:
arduino IDE's file is where exactly?

It's the program you're using to compile and upload the code:
https://www.arduino.cc/en/Guide/Environment

So ide is the app that I have downloaded?

The IDE (Integrated Development Environment) is the program where you write, compile and upload your programs on the PC

Thank you all very much, I am trying to download the libraries but it just doesn't processes data fast. If there is nothing else to add I will inform you as soon as possible

Actually I have one more question. When the zip file with the library is downloaded, what do I do next?

Here's how you install a library from a .zip file:

  • (In the Arduino IDE) Sketch > Include Library > Add .ZIP Library
  • Select the downloaded .zip file.
  • Click the "Open" button.

More information: