Hello and a heads up Newbie Alert
I am trying to automate the grow lights on my strawberries that only get the morning to midday sun. My aim is to set a digital pin HIGH or LOW which will drive a IRFZ44N FET to turn on the 12v power at about 1 - 1:30pm and turn off at 9pm. Current draw is around 3.5 amps.
The RTC I am using requires the PCF8563 library and I know my code has some obvious flaws that you guru’s will probably identify in seconds but it has taken me all afternoon to get this far. I appreciate any help you may offer, thank you in advance.
The code I have thus far is as follows;
#include <Wire.h>
#include <Rtc_Pcf8563.h>
#define PCF8563address 0x51
int lightPin = 5; // Set the LIGHT POWER pin
int t;
int second;
int minute;
int hour;
const int OnHour = 13; // Set the start and end times
const int OnMinute = 30;
const int OffHour = 21;
const int OffMinute = 0;
void readPCF8563()// this gets the time and date from the PCF8563
{
Wire.beginTransmission(PCF8563address);
Wire.requestFrom(PCF8563address, 7);
}
void loop () {
if(hour == OnHour && minute == OnMinute){
{digitalWrite(lightPin,HIGH);}
}
}
{
else if(hour == OffHour && minute == OffMinute)
{digitalWrite(lightPin,LOW);}
}
delay(1000);
}