whoops!
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <OneWire.h>
#include <DS1307RTC.h>
#include <Time.h>
#include <Timezone.h>
TimeChangeRule myDST = {"PST", First, Sun, Nov, 2, -420}; //Standard time = UTC - 8 hours
TimeChangeRule mySTD = {"PDT", Second, Sun, Mar, 2, -480}; //Daylight time = UTC - 7 hours
Timezone myTZ(myDST, mySTD);
TimeChangeRule *tcr; //pointer to the time change rule, use to get TZ abbrev
time_t utc, local;
int DS18S20_Pin = 10; //DS18S20 Signal
OneWire ds(DS18S20_Pin); //Temperature chip i/o
LiquidCrystal_I2C lcd(0x27, 20, 4);
#define RELAY1 30 //open
#define RELAY2 32 //fan
#define RELAY3 34 //heater
#define RELAY4 36 //ATO pump
const int FloatSwitch1 = 38; //pump control
const int FloatSwitch2 = 40; //overfill safety
const int FloatSwitch3 = 42; //reservoir empty
const int FloatSwitch4 = 44; //reservoir low
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int blueLed = 2;
int whiteLed = 3;
int violetLed = 4;
int ocwLed = 5;
/*************** LED variables ******************/
int minCounter = 0; // counter that resets at midnight. Don't change this.
int fadeDuration = 240; // duration of the fade on and off for sunrise and sunset.
int blueStartMins = 540; // number of minutes past midnight to start
int whiteStartMins = 540;
int violetStartMins = 540;
int ocwStartMins = 540;
int bluePhotoPeriod = 240; // photoperiod in minutes.
int whitePhotoPeriod = 240;
int violetPhotoPeriod = 240;
int ocwPhotoPeriod = 240;
int blueMax = 200; // max intensity.
int whiteMax = 200;
int violetMax = 255;
int ocwMax = 255;
/************** LED functions *******************/
//set LED brightness according to time of day - fade up, hold, fade down
void setLed(int mins, // current time in minutes
int ledPin, // pin for this channel of LEDs
int start, // start time for this channel of LEDs
int period, // photoperiod for this channel of LEDs
int fade, // fade duration for this channel of LEDs
int ledMax // max value for this channel
) {
if (mins > start && mins <= start + fade) {
analogWrite(ledPin, map(mins - start, 0, fade, 0, ledMax));
}
if (mins > start + period && mins <= start + period - fade) {
analogWrite(ledPin, ledMax);
}
if (mins > start + period - fade && mins <= start + period) {
analogWrite(ledPin, map(mins - start + period - fade, 0, fade, ledMax, 0));
}
}
void setup() {
Serial.begin(115200); // Used to type in characters
lcd.begin(); // initialize the lcd
setSyncProvider(RTC.get); // the function to get the time from the RTC
if (timeStatus() != timeSet)
Serial.println("Unable to sync with the RTC");
else
Serial.println("RTC has set the system time");
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, HIGH);
digitalWrite(RELAY3, HIGH);
digitalWrite(RELAY4, HIGH);
pinMode(FloatSwitch1, INPUT);
pinMode(FloatSwitch2, INPUT);
pinMode(FloatSwitch3, INPUT);
pinMode(FloatSwitch4, INPUT);
digitalWrite(FloatSwitch1, HIGH);
digitalWrite(FloatSwitch2, HIGH);
digitalWrite(FloatSwitch3, HIGH);
digitalWrite(FloatSwitch4, HIGH);
}
void loop() {