RTC errors

Hi, I got this following code from " Real-Time Clock Controlled Herbal Garden Watering System - Arduino Project Hub "
after adding the rtc & time library I’m still getting some errors please help me with it.
The following is the code:-

//             Herbal garden watering project                //
/* 
 The followign part of the code is from https://create.arduino.cc/projecthub/robotgeek-projects-team/using-a-real-time-clock-with-arduino-6b3896 
 and from http://www.instructables.com/id/How-to-use-a-Buzzer-Arduino-Tutorial/
 */
#include <Wire.h>
#include <DS1307RTC.h>

DS1307RTC clock ;//define a object of DS1307 class

const int RELAY = 4; //Relay set to digital pin 4
const int buzzer = 9; //Buzzer set to digital pin 9

void setup()
{
  pinMode(RELAY, OUTPUT);
  clock.begin();
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
}
void loop()
{
  timedRelay();
  tone(buzzer, 2000); // Send 2KHz sound signal...
  delay(500);        // ...for half sec
  noTone(buzzer);     // Stop sound...
  delay(500);        // ...for half sec
}

void timedRelay()
{
  clock.getTime();

  switch (clock.hour)
  {
    case 6: //when the clock reads 6 AM seconds (Once every 24 hours)
      digitalWrite(RELAY, HIGH);   // turn the Relay on (HIGH is the voltage level)
      delay(20000);              // wait for 20 second
      digitalWrite(RELAY, LOW);    // turn the Relay off by making the voltage LOW
      delay(3600000);              // wait for 3600 second
  }

   switch (clock.hour)
  {
    case 20: //when the clock reads 8 PM seconds (Once every 24 hours)
      digitalWrite(RELAY, HIGH);   // turn the Relay on (HIGH is the voltage level)
      delay(20000);              // wait for 20 second
      digitalWrite(RELAY, LOW);    // turn the Relay off by making the voltage LOW
      delay(3600000);              // wait for 3600 second
  }
}

The error message are as follow:
Arduino: 1.8.12 (Windows 10), Board: “Arduino Uno”

IC:\Users\abhi1\Documents\Arduino\libraries\DS1307RTC-master" “-IC:\Users\abhi1\Documents\Arduino\libraries\Time-master” “C:\Users\abhi1\AppData\Local\Temp\arduino_build_507373\sketch\rtc_water.ino.cpp” -o “C:\Users\abhi1\AppData\Local\Temp\arduino_build_507373\sketch\rtc_water.ino.cpp.o”
C:\Users\abhi1\Documents\Arduino\rtc_water\rtc_water.ino: In function ‘void setup()’:

rtc_water:17:9: error: ‘class DS1307RTC’ has no member named ‘begin’

clock.begin();

^~~~~

C:\Users\abhi1\Documents\Arduino\rtc_water\rtc_water.ino: In function ‘void timedRelay()’:

rtc_water:31:9: error: ‘class DS1307RTC’ has no member named ‘getTime’

clock.getTime();

^~~~~~~

rtc_water:33:17: error: ‘class DS1307RTC’ has no member named ‘hour’

switch (clock.hour)

^~~~

rtc_water:42:18: error: ‘class DS1307RTC’ has no member named ‘hour’

switch (clock.hour)

^~~~

Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Using library DS1307RTC-master at version 1.4.1 in folder: C:\Users\abhi1\Documents\Arduino\libraries\DS1307RTC-master
Using library Time-master at version 1.6 in folder: C:\Users\abhi1\Documents\Arduino\libraries\Time-master
exit status 1
‘class DS1307RTC’ has no member named ‘begin’

Help me with a solution

Where did you get the RTC library from ?

Looks like the library they used is no longer in the location they got it from: https://wiki.seeedstudio.com/File:RTC_Library.zip

The new location for the Grove RTC library appears to be:
https://github.com/Seeed-Studio/RTC_DS1307/archive/master.zip
I checked and that library has the ".begin()" and ".getTime()" methods.

johnwasser:
Looks like the library they used is no longer in the location they got it from: https://wiki.seeedstudio.com/File:RTC_Library.zip

The new location for the Grove RTC library appears to be:
https://github.com/Seeed-Studio/RTC_DS1307/archive/master.zip
I checked and that library has the ".begin()" and ".getTime()" methods.

Thank you soo much. It worked for me. 8) 8) :wink:

UKHeliBob:
Where did you get the RTC library from ?

This was the link:-
https://www.pjrc.com/teensy/td_libs_DS1307RTC.html