#include <Stepper.h>
#include <LiquidCrystal.h>
#include<Wire.h>
#include <RTClib.h>
char Month;
RTC_DS1307 rtc;
//static DS1307 RTC;
const int stepsPerRevolution=200;
Stepper myStepper(stepsPerRevolution,8,9,10,11); // create stepper object to control a motor
 int stepPos = 0;    // variable to store the stepper position 
int buzzer=8;
long FISHFEEDER = 43200000; // 12 hours between feeding
long endtime; 
long now;
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

void setup() 
{
   Serial.begin(9600);

 lcd.begin(16, 2);
  myStepper.setSpeed(30);  //set speed of the motor 
  delay(15);
  Wire.begin();
   rtc.begin();
 // rtc.setHourMode(CLOCK_H12);
  //RTC.setHourMode(CLOCK_H24);

 // if (RTC.getHourMode() == CLOCK_H12)
 // {
 //    RTC.setMeridiem(HOUR_PM);
 // }
/*
  RTC.setDay(13);
  RTC.setMonth(05);
  RTC.setYear(2020);

  RTC.setHours(9);
  RTC.setMinutes(47);
  RTC.setSeconds(56);
*/
 // RTC.setWeek(1);

 // RTC.setDate(22,07,24);
 // RTC.setTime(23,00,00);

}
 
void loop() 
{
  now = millis();
  endtime = now + FISHFEEDER;
  DateTime now=rtc.now();
Serial.print(now.year(),DEC);
Serial.print('/');
Serial.print(now.day(),DEC);
Serial.print('/');
Serial.print(now.hour(),DEC);
Serial.print(':');
Serial.print(now.minute(),DEC);
Serial.print(':');
Serial.print(now.second(),DEC);
Serial.println();
delay(1000);
  while(now < endtime) {
    Serial.println("clockwise");
   myStepper.step(stepsPerRevolution);
   tone(8,265,250);
   lcd.print("Thanks foe feeding us!");
   Serial.println("thanks for feeding us!");
   delay(2000);
    
   now = millis();   
  }
  

  for(stepPos = 0; stepPos < 180; stepPos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myStepper.step(stepPos);              // tell motor to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the motor to reach the position 
  } 
  for(stepPos = 180; stepPos>=0; stepPos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myStepper.step(stepPos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}

$abcdeabcde151015202530354045505560fghijfghij
GND5VSDASCLSQWRTCDS1307+
A4988