My Fish Feeder

Hi i’m trying to get my fish feeder run every 12 or 24 hours i have loaded my sketch into my ESP8266 and all work fine drives my 2 servo motors open 45 degrees and closes again i had the delay time set for 1 hour but when i set it for 12 hour nothing happened. i know i should be using millis but how and where has got me below is my code if someone could please steer me in the right direction would save me pulling me hair out

Kind regards

Ricky

#include <Time.h>
#include <TimeLib.h>
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>

const char* ssid = “Network”;
const char* password = “”;
const char* host = “maker.ifttt.com”;
const int httpsPort = 443;
Servo myservo;

int pos = 0; // variable to store the servo position

void setup() {
Serial.begin(9600);
Serial.println();
Serial.print(“connecting to “);
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(”.”);
}
Serial.println("");
Serial.println(“WiFi connected”);
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println(“connection failed”);
return;
}
String url = “/trigger/Fish Feeder Reset/with/key/”;
Serial.print("requesting URL: ");
Serial.println(url);
client.print(String("GET “) + url + " HTTP/1.1\r\n” +
"Host: " + host + “\r\n” +
“User-Agent: BuildFailureDetectorESP8266\r\n” +
“Connection: close\r\n\r\n”);
Serial.println(“request sent”);
while (client.connected()) {
String line = client.readStringUntil(’\n’);
if (line == “\r”) {
Serial.println(“headers received”);
break;
}
}
String line = client.readStringUntil(’\n’);

Serial.println(“reply was:”);
Serial.println("==========");
Serial.println(line);
Serial.println("==========");
Serial.println(“closing connection”);

myservo.attach(2); // attaches the servo on pin GIO2 to the servo object
Serial.begin(9600);
while (!Serial);
setTime(21, 53, 00, 26, 8, 2018); // set the current time to 14:27:00, December 14th, 2015
Serial.println(“Fish Feeder Reset”);
}

void loop() {
for (pos = 0; pos <= 45; pos += 1) { // goes from 0 degrees to 45 degrees in steps of 1 degree
myservo.write(pos);
// myservo2.write(pos);// tell servo to go to position in variable ‘pos’
delay(5); // waits 15ms for the servo to reach the position
}
for (pos = 45; pos >= 0; pos -= 1) { // goes from 45 degrees to 0 degrees in steps of 1 degree
myservo.write(pos);
// myservo2.write(pos);// tell servo to go to position in variable ‘pos’
delay(5); // waits 15ms for the servo to reach the position
}
{
Serial.println(“Fish Have Been Feed”);
delay(43200000);// 10mins = 600000 1hour = 3600000 12hr = 43200000 here is the problem

Serial.begin(9600);
Serial.println();
Serial.print(“connecting to “);
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(”.”);
}
Serial.println("");
Serial.println(“WiFi connected”);
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println(“connection failed”);
return;
}
String url = “/trigger/Fish Feed/with/key/”;
Serial.print("requesting URL: ");
Serial.println(url);
client.print(String("GET “) + url + " HTTP/1.1\r\n” +
"Host: " + host + “\r\n” +
“User-Agent: BuildFailureDetectorESP8266\r\n” +
“Connection: close\r\n\r\n”);
Serial.println(“request sent”);
while (client.connected()) {
String line = client.readStringUntil(’\n’);
if (line == “\r”) {
Serial.println(“headers received”);
break;
}
}
String line = client.readStringUntil(’\n’);

Serial.println(“reply was:”);
Serial.println("==========");
Serial.println(line);
Serial.println("==========");
Serial.println(“closing connection”);

}
Serial.print("Ok, Time = “);
print2digits(hour());
Serial.write(’:’);
print2digits(minute());
Serial.write(’:’);
print2digits(second());
Serial.print(”, Date (D/M/Y) = ");
Serial.print(day());
Serial.write(’/’);
Serial.print(month());
Serial.write(’/’);
Serial.print(year());
Serial.println();
delay(1000);
}

void print2digits(int number) {
if (number >= 0 && number < 10) {
Serial.write(‘0’);
}
Serial.print(number);
}