Hi, I got this following code from " https://create.arduino.cc/projecthub/maximilian-dullo/real-time-clock-controlled-herbal-garden-watering-system-d19e45 "
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