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

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

DS3231 rtc(SDA, SCL);

^

D:\Downloads\aaa\aaa.ino:14:21: note: candidates are:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note: DS3231::DS3231()

DS3231();

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note: candidate expects 0 arguments, 2 provided

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: constexpr DS3231::DS3231(const DS3231&)

class DS3231 {

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: candidate expects 1 argument, 2 provided

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: constexpr DS3231::DS3231(DS3231&&)

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: candidate expects 1 argument, 2 provided

aaa:16: error: 'Time' does not name a type

Time t;

^

D:\Downloads\aaa\aaa.ino: In function 'void setup()':

aaa:49: error: 'class DS3231' has no member named 'begin'

rtc.begin();

^

D:\Downloads\aaa\aaa.ino: In function 'void InitialiseClock()':

aaa:63: error: 'class DS3231' has no member named 'setTime'

rtc.setTime(h, m, s);

^

aaa:64: error: no matching function for call to 'DS3231::setDate(int&, int&, int&)'

rtc.setDate(Day, Month, Year); //

^

D:\Downloads\aaa\aaa.ino:64:31: note: candidate is:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

void setDate(byte Date);

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: candidate expects 1 argument, 3 provided

D:\Downloads\aaa\aaa.ino: In function 'void loop()':

D:\Downloads\aaa\aaa.ino:78:24: warning: NULL used in arithmetic [-Wpointer-arith]

if (!Time_Water_h == NULL || !Interval == NULL || !Water_howlong == NULL )

^

D:\Downloads\aaa\aaa.ino:78:45: warning: NULL used in arithmetic [-Wpointer-arith]

if (!Time_Water_h == NULL || !Interval == NULL || !Water_howlong == NULL )

^

D:\Downloads\aaa\aaa.ino:78:71: warning: NULL used in arithmetic [-Wpointer-arith]

if (!Time_Water_h == NULL || !Interval == NULL || !Water_howlong == NULL )

^

aaa:126: error: 'class DS3231' has no member named 'getTimeStr'

lcd.print(rtc.getTimeStr());

^

aaa:129: error: 'class DS3231' has no member named 'getDateStr'

lcd.print(rtc.getDateStr());

^

D:\Downloads\aaa\aaa.ino: In function 'void SetDate()':

aaa:193: error: no matching function for call to 'DS3231::setDate(int&, int&, int&)'

rtc.setDate(Day, Month, Year);

^

D:\Downloads\aaa\aaa.ino:193:32: note: candidate is:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

void setDate(byte Date);

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: candidate expects 1 argument, 3 provided

aaa:202: error: 'class DS3231' has no member named 'getDateStr'

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:202: error: 'FORMAT_SHORT' was not declared in this scope

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:222: error: no matching function for call to 'DS3231::setDate(int&, int&, int&)'

rtc.setDate(Day, Month, Year);

^

D:\Downloads\aaa\aaa.ino:222:33: note: candidate is:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

void setDate(byte Date);

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: candidate expects 1 argument, 3 provided

aaa:235: error: 'class DS3231' has no member named 'getDateStr'

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:235: error: 'FORMAT_SHORT' was not declared in this scope

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:255: error: no matching function for call to 'DS3231::setDate(int&, int&, int&)'

rtc.setDate(Day, Month, Year);

^

D:\Downloads\aaa\aaa.ino:255:32: note: candidate is:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

void setDate(byte Date);

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: candidate expects 1 argument, 3 provided

aaa:268: error: 'class DS3231' has no member named 'getDateStr'

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:268: error: 'FORMAT_SHORT' was not declared in this scope

lcd.print(rtc.getDateStr(FORMAT_SHORT));

^

aaa:284: error: no matching function for call to 'DS3231::setDate(int&, int&, int&)'

rtc.setDate(Day, Month, Year);

^

D:\Downloads\aaa\aaa.ino:284:35: note: candidate is:

In file included from D:\Downloads\aaa\aaa.ino:7:0:

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

void setDate(byte Date);

^

C:\Users\hikar\OneDrive\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: candidate expects 1 argument, 3 provided

aaa:296: error: 'class DS3231' has no member named 'getTimeStr'

lcd.print(rtc.getTimeStr());

^

aaa:330: error: 'class DS3231' has no member named 'getTimeStr'

lcd.print(rtc.getTimeStr());

^

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

I'm a beginner and i'm stuck , how can I fix this?

I'm a beginner and i'm stuck , how can I fix this?

Start by posting your code

DS3231  rtc(SDA, SCL);

Does the constructor need the parameters ?
It seems not

this is my code

#include <Time.h>
#include <TimeLib.h>
#include <LiquidCrystal.h>
#include <DS3231.h>
#include <dht.h>

// Initialize LCD with following connections
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
DS3231 rtc(SDA, SCL);
dht DHT;
Time t;

#define DHT22_PIN 13

const int PIN_BUTTON1 = 7; // digital
const int PIN_BUTTON2 = 8; // digital
const int PUMP = 6; // digital
const int ALERT_LED = 10;
const int read = A0; //Sensor AO pin to Arduino pin A0
int value; //Variable to store the incomming data

void ReadWaterLvl();
void SetProgram();

int Day , Month ;
int Year = 2000;
int h, m, s;
int DayOfTheWeek;

int Time_Water_h ;
int Interval ;
int Water_howlong;

int Current_m;

bool set;
bool Pump_ON;
bool Prog_Run;

void setup() {

Serial.begin(9600);
rtc.begin();

pinMode(ALERT_LED, OUTPUT);

pinMode(PUMP, OUTPUT);

lcd.begin(16, 2);

}

void InitialiseClock()
{
// rtc.setDOW(DayOfTheWeek);
rtc.setTime(h, m, s);
rtc.setDate(Day, Month, Year); //
}

void loop() {
lcd.clear();
lcd.noBlink();

if(HIGH == digitalRead(PIN_BUTTON1) && HIGH == digitalRead(PIN_BUTTON2))
{
delay(250);
SetDate();

}

if (!Time_Water_h == NULL || !Interval == NULL || !Water_howlong == NULL )
{
if(Time_Water_h == hour()|| Time_Water_h + Interval == hour())
{
if (minute() >= Water_howlong)
{ digitalWrite(PUMP, HIGH);
Prog_Run = true;
}
else{digitalWrite(PUMP, LOW);}

}

}

if(HIGH == digitalRead(PIN_BUTTON1))
{
lcd.clear();
int chk = DHT.read22(DHT22_PIN);
switch (chk)
{
case DHTLIB_OK:
Serial.println(“OK,\t”);
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.println(“Checksum error,\t”);
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.println(“Time out error,\t”);
break;
default:
Serial.println(“Unknown error,\t”);
break;
}

lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Celsius: ");
lcd.setCursor(11, 0);
lcd.print(DHT.temperature);

lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.setCursor(11, 1);
lcd.print(DHT.humidity);

}

else{ lcd.setCursor(0, 0);
lcd.print(rtc.getTimeStr());

lcd.setCursor(0, 1);
lcd.print(rtc.getDateStr());

}

ReadWaterLvl();

if ( value>700 )
{
lcd.clear();
while(value>700)
{
lcd.setCursor(0, 0);
lcd.print(“TOO MUCH WATER!!”);
lcd.scrollDisplayLeft();
digitalWrite(ALERT_LED, HIGH);
delay (500);
ReadWaterLvl();}

}
else{

digitalWrite(ALERT_LED, LOW);
}

if (value<=480 )
{
lcd.clear();
while(value<=480)
{

lcd.setCursor(0, 0);
lcd.print(“TOO LITTLE WATER!!”);
lcd.scrollDisplayLeft();
digitalWrite(ALERT_LED, HIGH);
delay (500);
ReadWaterLvl();}

}
else{

digitalWrite(ALERT_LED, LOW);
}

if(HIGH == digitalRead(PIN_BUTTON2) && Pump_ON == false && Prog_Run == false)
{digitalWrite(PUMP, HIGH);
Pump_ON = true;
}
else if (HIGH == digitalRead(PIN_BUTTON2) && Pump_ON == true && Prog_Run == false)
{digitalWrite(PUMP, LOW);
Pump_ON = false;}

Serial.println(hour());

delay (200); ///Dont under estimate the delay, LCD needs it to correctly print
}

void SetDate()
{
Month = Day = 1;
Year = 2000;
rtc.setDate(Day, Month, Year);

while (set == false) ///set day
{

lcd.clear();
lcd.print("ENTER DAY: ");
lcd.setCursor(0,1);
lcd.print(rtc.getDateStr(FORMAT_SHORT));
lcd.setCursor(1,1);
lcd.blink();

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Day += 1;
}

if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (Day > 31)
{
Day = 1;
}

rtc.setDate(Day, Month, Year);
delay (250);
}

/*************************************************/
set = false;
while (set == false) //set month
{

lcd.clear();
lcd.print("ENTER MONTH: ");
lcd.setCursor(0,1);
lcd.print(rtc.getDateStr(FORMAT_SHORT));
lcd.setCursor(4,1);
lcd.blink();

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Month += 1;
}

if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (Month > 12)
{
Month = 1;
}

rtc.setDate(Day, Month, Year);
delay (250);
}

/********************************************************/
set = false;
while (set == false) //set year
{

lcd.clear();
lcd.print("ENTER YEAR: ");
lcd.setCursor(0,1);
lcd.print(rtc.getDateStr(FORMAT_SHORT));

lcd.setCursor(7,1);
lcd.blink();

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Year += 1;
}

if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}
rtc.setDate(Day, Month, Year);
delay (250);
}

/******************************************/
set = false;
while (set == false) //set h
{

lcd.clear();
lcd.print(“ENTER TIME: h”);
lcd.setCursor(0,1);
lcd.print(rtc.getTimeStr());

lcd.setCursor(1,1);
lcd.blink();

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
h += 1;
}

if (HIGH == digitalRead(PIN_BUTTON2))
{

set = true;
}

if (h > 23)
{
h = 0;
}
InitialiseClock();
delay (250);
}

/*************************************************/
set = false;
while (set == false) //set m
{

lcd.clear();
lcd.print(“ENTER TIME: m”);
lcd.setCursor(0,1);
lcd.print(rtc.getTimeStr());

lcd.setCursor(4,1);
lcd.blink();

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
m += 1;
}

if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (m > 59)
{
m = 0;
}
InitialiseClock();
delay (250);
}

setTime(h, m, 0, Day, Month, Year);
SetProgram();
set = false;
}

void SetProgram()
{
/********************************************************** SET Hour*/
set = false;
while(set == false)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Water starts at:”);
lcd.setCursor(0, 1);
lcd.print(Time_Water_h);

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Time_Water_h += 1;
}
if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (Time_Water_h > 23)
{
Time_Water_h = 0;
}
delay (250);
}

/********************************************************** SET Interval*/

set = false;
while(set == false)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“How often:”);
lcd.setCursor(0, 1);
lcd.print("Every ");
lcd.setCursor(6, 1);
lcd.print(Interval);
lcd.setCursor(8, 1);
lcd.print(“hours”);

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Interval += 1;
}
if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (Interval > 24)
{
Time_Water_h = 0;
}
delay (250);
}

/********************************************************** SET Length*/

set = false;
while(set == false)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“For how long:”);
lcd.setCursor(0, 1);
lcd.print(Water_howlong);
lcd.setCursor(3, 1);
lcd.print(“minutes”);

if (HIGH == digitalRead(PIN_BUTTON1))
{
lcd.noBlink();
Water_howlong += 1;
}
if (HIGH == digitalRead(PIN_BUTTON2))
{
set = true;
}

if (Water_howlong > 30)
{
Water_howlong = 0;
}
delay (250);
}
}

void ReadWaterLvl()
{
value = analogRead(A0); //Read data from analog pin and store it to value variable
Serial.println(value);

}

See reply #1

I would start with a sketch that only works with the DS3231; remove the rest (use serial monitor) for debugging purposes.

Once you get that working, write test sketches for the other components.

Once you have figured everything out, combine.

By the way, when posting code on the forum, use code tags; please edit your reply and
Type
** **[code]** **
before your code
Type
** **[/code]** **
after your code