so far I keep getting errors
#include <RTClib.h> // Real time clock
#include <DHT.h> // Air Temp Humid Sensor
#include <OneWire.h> // Sensors (water temp) connected to one wire
#include <DallasTemperature.h> // Water Temp Sensor
#include <LiquidCrystal_I2C.h> // Lcd display
const int lightingPin = 4;
const int bulblightingPin = 9;
const int pumpPin = 6;
RTC_DS3231 rtc; // Init the DS3231 using the hardware interface (Nano A4=SDA A5=SCL)
unsigned long currentTime;
unsigned long previousTime = 0;
int marker = 0;
int lampState =0;
unsigned long pumpState =0;
unsigned long hour = 0;
int pumpHour =0;
char dateBuffer [12];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lcd Display ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
// set the LCD address to 0x3F or 0x27 depending what display using for a 16 chars 2 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Air Temperature & Humidity sensor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor
int chk;
float hum; //Stores humidity value
float temp; //Stores temperature value
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Water Temperature sensor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
//########################################################################## SETUP ###################################################################################################
void setup()
{
Serial.begin(9600);
rtc.begin(); // Initialize the rtc object
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines
lcd.backlight(); // Turns backlight LCD on
sensors.begin(); // water temp sensor
dht.begin(); // temp humid sensor
pinMode (lightingPin, OUTPUT);
digitalWrite (lightingPin, HIGH);
pinMode (bulblightingPin, OUTPUT);
digitalWrite (bulblightingPin, HIGH);
pinMode (pumpPin, OUTPUT);
digitalWrite (pumpPin, HIGH);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Uncomment to set the date and time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // Automatic RTC DS3231 time update from computer clock while compiling
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // This line sets the RTC with an explicit date & time for example to set January 21, 2014 at 3am
}
//########################################################################## LOOP ###################################################################################################
void loop()
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OUTPUT REAL TIME CLOCK ON SERIAL ~~~~~~~~~~~~~~~~~~~~~~~~~~
DateTime now = rtc.now();
sprintf(dateBuffer,"%02u-%02u-%04u ",now.day(),now.month(),now.year());
Serial.print(dateBuffer);
sprintf(dateBuffer,"%02u:%02u:%02u ",now.hour(),now.minute(),now.second());
Serial.println(dateBuffer);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lighting RELAY ACTION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lampState = (now.hour()*60) + now.minute(); // Hour times it by 60 add the minutes, 18 hour cycle 5am = 300 11pm = 1380
// 12 hour cycle 6am = 360 12am = 00
// 14 hour cycle 6am = 360 2am = 1200
if (lampState >= 360 && lampState < 1200){
digitalWrite (lightingPin, HIGH);
digitalWrite (bulblightingPin, LOW);
Serial.println("Lights ON");
}
else {
digitalWrite (lightingPin, LOW);
digitalWrite (bulblightingPin, HIGH);
Serial.println("Lights OFF");
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Water Pump Relay Times ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
now.hour() = pumpHour;
pumpState = (pumpHour*3600) + (now.minute()*60) + now.second();
if (pumpState >= 55440 && pumpState < 55485){
digitalWrite (pumpPin, LOW);
Serial.println("Water Pump ON");
}
else {
digitalWrite (pumpPin, HIGH);
Serial.println("Water Pump OFF");
}
lvalue required as left operand of asignment