Simple Serial.print question

Hi,

I'm having a little trouble with this line. The relay that controls the light works fine, but I am struggling with how to print it to serial. Let me know if this is not enough code to give an answer.

Thank you.

Serial.print("Aquarium Light:"); 
if (Lights1, HIGH) Serial.print(" Off");  
else if (Lights1, LOW) Serial.print(" On"); 
Serial.println();

Check the syntax of an If statement
if (Lights1 == HIGH) ....assuming of course Lights1 is up to date (from a digitalRead() ) and not a PIN number

Well, thank you. I feel like I have made some progress. Thank you for your help.

My problem now is that the serial monitor reflects the change in the relay, but it lists both the 'off' and the 'on' in the monitor.

Feel like I should know this, but I appreciate the help. working on it.

Serial.print("Aquarium Light:");
if (now.hour() == OnHour1 && now.minute() == OnMin1)
Serial.print(" On");
else if (now.hour() == OffHour1 && now.minute() == OffMin1);
Serial.print(" Off");
Serial.println();

nevermind... i think this worked.
Thank you.

Serial.print("Aquarium Light:");
if (now.hour() == OnHour1 && now.minute() == OnMin1)
Serial.print(" On");
else if (now.hour() == OffHour1 && now.minute() == OffMin1)
Serial.print(" Off");
Serial.println();

never mind again...

tried it with a second relay and its fudged again...

Serial.print("Aquarium Light:");
if (now.hour() == OnHour1 && now.minute() == OnMin1)
Serial.print(" On");
else if (now.hour() == OffHour1 && now.minute() == OffMin1)
Serial.print(" Off");
Serial.println();

Serial.print("Sump Light:");
if (now.hour() == OnHour2 && now.minute() == OnMin2)
Serial.print(" On");
else if (now.hour() == OffHour2 && now.minute() == OffMin2)
Serial.print(" Off");
Serial.println();

First, please read the sticky at the top of every forum: Read this before posting a programming question ...

Post your whole sketch and tell us what isn't working, or what error message you're getting.

Hi SteveMann,

Apologies and thank you.

I don't have an error message. The code compiles. I am just having problems with how the serial prints the actions of the relays

//Paludarium Monitor V.003a
//This Sketch works as of August 29
//RTC is working, 2 DS18B20 temp probes, 1 DHT11 (though it shit), 2 relays (Lights1 & Lights2 work),
//Not working yet is the flow rate sensor, ph sensor...
//2nd relay is working independently of the first. can't figure out serial.print yet.

#include <SimpleDHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> // For I2C
#include <RTClib.h>

//Establishes pin for DHT11 sensor: 
int pinDHT11 = 5;
SimpleDHT11 dht11;

//Establishes the pins for Lights relays.. 
int Lights1 = 6;
int Lights2 = 11;
//int Heater = 
//int airpump = 

//Establishes on & off times for Lights1
const int OnHour1 = 2;  // Hour Value of Lights1 On Time (In 24 hour format)
const int OnMin1 = 40;  // Minute Value of Lights1 On Time 
const int OffHour1 = 2; // Hour Value of Lights1 Off Time (In 24 hour format)
const int OffMin1 = 41; // Minute Value of Lights1 On Time

//Establishes on & off times for Lights2
const int OnHour2 = 1;  // Hour Value of Lights2 On Time (In 24 hour format)
const int OnMin2 = 33;   // Minute Value of Lights2 On Time 
const int OffHour2 = 1; // Hour Value of Lights2 Off Time (In 24 hour format)
const int OffMin2 = 35;  // Minute Value of Lights2 On Time


RTC_DS1307 rtc;  

//DS18b20:
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

int deviceCount = 0;
float tempC;

  LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {
  Serial.begin(9600);
  sensors.begin();
  lcd.init();
  lcd.init();
  lcd.backlight();
  
  // Setting up Lights1 & Lights2 relay switches... 
  pinMode(Lights1, OUTPUT);
  digitalWrite(Lights1, LOW);
  pinMode(Lights2, OUTPUT);
  digitalWrite(Lights2, LOW);
  
  if(! rtc.begin()) {
  Serial.println("Couldn't find RTC");
  while (1);
  }
  
  else {
  // following line sets the RTC to the date & time this sketch was compiled
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
  
  if(! rtc.isrunning()) {
  Serial.println("RTC is NOT running!");
  }
  
}

void loop() 

{
  Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.print("|-.+.-.-.+.-.-.+.-.-.-|"); Serial.println();
  Serial.print("|75 Gallon Paludarium:|"); Serial.println();
  Serial.print("|||||||||||||||||||||||"); Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.println();
  
  DateTime now = rtc.now();
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), 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.println(now.second(), DEC);
  //myFile.close();
  
  byte temperature = 0;
  byte humidity = 0;
  byte data[40] = {0};
  if (dht11.read(pinDHT11, &temperature, &humidity, data)) {
  //Serial.print("Read DHT11 failed"); Serial.println();
  
  sensors.requestTemperatures(); 
  //Serial.println("");
  
}

  //lcd.setCursor(0,0); lcd.print("75 Gallon Paludarium");
  lcd.setCursor(0,0); lcd.print(now.year(), DEC);
  lcd.setCursor(4,0); lcd.print("/");
  lcd.setCursor(5,0); lcd.print(now.month(), DEC);
  lcd.setCursor(7,0); lcd.print('/');
  lcd.setCursor(8,0); lcd.print(now.day(), DEC);
  lcd.setCursor(10,0); lcd.print(" | ");
  lcd.setCursor(12,0); lcd.print(now.hour(), DEC);
  lcd.setCursor(14,0); lcd.print(':');
  lcd.setCursor(15,0); lcd.print(now.minute(), DEC);
  lcd.setCursor(17,0); lcd.print(':');
  lcd.setCursor(18,0); lcd.println(now.second(), DEC);
  lcd.setCursor(0,1); lcd.print("Air:"); lcd.print(sensors.getTempCByIndex(1));
  lcd.setCursor(11,1); lcd.print("RH%:"); lcd.print((int)humidity);
  lcd.setCursor(0,2); lcd.print("h20:"); lcd.print(sensors.getTempCByIndex(0));
  lcd.setCursor(11,2); lcd.print("LPH:");
  lcd.setCursor(0,3); lcd.print("L1:"); if (Lights1, HIGH) { lcd.setCursor(3,3); lcd.print(" Off"); } else {(Lights1, LOW); lcd.print(" On"); }
  lcd.setCursor(12,3); lcd.print("pH:");
  
  Serial.println(".......................");
  Serial.println(); 
  Serial.print("Air Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println();
  Serial.print("Relative Humidity: "); Serial.print((int)humidity); Serial.print("%"); Serial.println();
  
  sensors.requestTemperatures(); 
  
  Serial.print("H20 Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println(); 
  Serial.print("Flow Rate:"); Serial.print((int)temperature); Serial.println(" Litres/hour"); //Serial.println(); 
  Serial.print("Co2:"); Serial.println(" N/A");
  Serial.print("Heater:"); Serial.println(" N/A");
  Serial.print("Air Pumps:"); Serial.println(" N/A");
  //trying this line... blurg...
  
  
  Serial.print("Aquarium Light:"); 
  if (now.hour() == OnHour1 && now.minute() == OnMin1) 
  Serial.print(" On");  
  else if (now.hour() == OffHour1 && now.minute() == OffMin1)
  Serial.print(" Off");  
  Serial.println(); 
  
  /*Serial.print("Sump Light:"); 
  if (now.hour() == OnHour2 && now.minute() == OnMin2) 
  Serial.print(" On");  
  else if (now.hour() == OffHour2 && now.minute() == OffMin2)
  Serial.print(" Off");  
  Serial.println(); */
  //Serial.print("Sump Light:"); if (Lights2, HIGH) { Serial.print(" Off"); } else if (Lights2, LOW) { Serial.print(" On"); }  Serial.println(); 
  
  Serial.print("Over Head:"); Serial.println(" N/A");
  Serial.println(); 
  Serial.print("......................."); 
  Serial.println();
 
  if(now.hour() == OnHour1 && now.minute() == OnMin1) {digitalWrite(Lights1, HIGH); }
  else if (now.hour() == OffHour1 && now.minute() == OffMin1) {digitalWrite(Lights1, LOW);}
  
  if(now.hour() == OnHour2 && now.minute() == OnMin2) {digitalWrite(Lights2, HIGH); }
  else if (now.hour() == OffHour2 && now.minute() == OffMin2) {digitalWrite(Lights2, LOW);}
  
  delay(8000);
  
}

You're missing some { }

Example

if(whatever == true) {
//Everything that happens if true goes here
} else if(whatever == false){
// Everything that happens if false here
}

Thank you to DangerToMyself ... (hope all is good, :wink: )

The relays I am have are responding to the RTC timers well, but I can't figure out how to make the serial display the status of the relays. Right now, the first relay (lights1) turns on and says 'on' in the serial. When the second relay (Lights2) turns on, it says on but the first relay serial goes blank.

I think there is something that I am just not seeing, because the system is essentially working well in terms of relays.

I think the problem is around line 149.

This project is an exercise in practicing how to monitor sensors and relays.
Having fun and thanking you all for your help.

#include <SimpleDHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> // For I2C
#include <RTClib.h>

//Establishes pin for DHT11 sensor: 
int pinDHT11 = 5;
SimpleDHT11 dht11;

//Establishes the pins for Lights relays.. 
int Lights1 = 6;
int Lights2 = 11;
//int Heater = 
//int airpump = 

//Establishes on & off times for Lights1
const int OnHour1 = 3;  // Hour Value of Lights1 On Time (In 24 hour format)
const int OnMin1 = 57;  // Minute Value of Lights1 On Time 
const int OffHour1 = 3; // Hour Value of Lights1 Off Time (In 24 hour format)
const int OffMin1 = 59; // Minute Value of Lights1 On Time

//Establishes on & off times for Lights2
const int OnHour2 = 3;  // Hour Value of Lights2 On Time (In 24 hour format)
const int OnMin2 = 58;   // Minute Value of Lights2 On Time 
const int OffHour2 = 4; // Hour Value of Lights2 Off Time (In 24 hour format)
const int OffMin2 = 0;  // Minute Value of Lights2 On Time


RTC_DS1307 rtc;  

//DS18b20:
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

int deviceCount = 0;
float tempC;

  LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {
  Serial.begin(9600);
  sensors.begin();
  lcd.init();
  lcd.init();
  lcd.backlight();
  
  // Setting up Lights1 & Lights2 relay switches... 
  pinMode(Lights1, OUTPUT);
  digitalWrite(Lights1, LOW);
  pinMode(Lights2, OUTPUT);
  digitalWrite(Lights2, LOW);
  
  if(! rtc.begin()) {
  Serial.println("Couldn't find RTC");
  while (1);
  }
  
  else {
  // following line sets the RTC to the date & time this sketch was compiled
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
  
  if(! rtc.isrunning()) {
  Serial.println("RTC is NOT running!");
  }
  
}

void loop() 

{
  Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.print("|-.+.-.-.+.-.-.+.-.-.-|"); Serial.println();
  Serial.print("|75 Gallon Paludarium:|"); Serial.println();
  Serial.print("|||||||||||||||||||||||"); Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.println();
  
  DateTime now = rtc.now();
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), 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.println(now.second(), DEC);
  //myFile.close();
  
  byte temperature = 0;
  byte humidity = 0;
  byte data[40] = {0};
  if (dht11.read(pinDHT11, &temperature, &humidity, data)) {
  //Serial.print("Read DHT11 failed"); Serial.println();
  
  sensors.requestTemperatures(); 
  //Serial.println("");
  
}

  //lcd.setCursor(0,0); lcd.print("75 Gallon Paludarium");
  lcd.setCursor(0,0); lcd.print(now.year(), DEC);
  lcd.setCursor(4,0); lcd.print("/");
  lcd.setCursor(5,0); lcd.print(now.month(), DEC);
  lcd.setCursor(7,0); lcd.print('/');
  lcd.setCursor(8,0); lcd.print(now.day(), DEC);
  lcd.setCursor(10,0); lcd.print(" | ");
  lcd.setCursor(12,0); lcd.print(now.hour(), DEC);
  lcd.setCursor(14,0); lcd.print(':');
  lcd.setCursor(15,0); lcd.print(now.minute(), DEC);
  lcd.setCursor(17,0); lcd.print(':');
  lcd.setCursor(18,0); lcd.println(now.second(), DEC);
  lcd.setCursor(0,1); lcd.print("Air:"); lcd.print(sensors.getTempCByIndex(1));
  lcd.setCursor(11,1); lcd.print("RH%:"); lcd.print((int)humidity);
  lcd.setCursor(0,2); lcd.print("h20:"); lcd.print(sensors.getTempCByIndex(0));
  lcd.setCursor(11,2); lcd.print("LPH:");
  lcd.setCursor(0,3); lcd.print("L1:"); if (Lights1, HIGH) { lcd.setCursor(3,3); lcd.print(" Off"); } else {(Lights1, LOW); lcd.print(" On"); }
  lcd.setCursor(12,3); lcd.print("pH:");
  
  Serial.println(".......................");
  Serial.println(); 
  Serial.print("Air Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println();
  Serial.print("Relative Humidity: "); Serial.print((int)humidity); Serial.print("%"); Serial.println();
  
  sensors.requestTemperatures(); 
  
  Serial.print("H20 Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println(); 
  Serial.print("Flow Rate:"); Serial.print((int)temperature); Serial.println(" Litres/hour"); //Serial.println(); 
  Serial.print("Co2:"); Serial.println(" N/A");
  Serial.print("Heater:"); Serial.println(" N/A");
  Serial.print("Air Pumps:"); Serial.println(" N/A");
  //trying this line... blurg...
  
  
  Serial.print("Aquarium Light:"); 
  if(now.hour() == OnHour1 && now.minute() == OnMin1) 
  {digitalWrite(Lights1, HIGH); Serial.print(" On");}
  else if (now.hour() == OffHour1 && now.minute() == OffMin1) 
  {digitalWrite(Lights1, LOW); Serial.print(" Off");}
  Serial.println(); 
  /*
  if (now.hour() == OnHour1 && now.minute() == OnMin1)
  { 
  Serial.print(" On");}
  else if (now.hour() == OffHour1 && now.minute() == OffMin1){
  Serial.print(" Off");}*/
 
  
  Serial.print("Sump Light:"); 
  if(now.hour() == OnHour2 && now.minute() == OnMin2) 
  {digitalWrite(Lights2, HIGH); Serial.print(" On");}
  else if (now.hour() == OffHour2 && now.minute() == OffMin2) 
  {digitalWrite(Lights2, LOW); Serial.print(" Off");}
  Serial.println(); 
  /*
  if (now.hour() == OnHour2 && now.minute() == OnMin2) 
  {Serial.print(" On");}  
  else if (now.hour() == OffHour2 && now.minute() == OffMin2)
  {Serial.print(" Off");}  */

  //Serial.print("Sump Light:"); if (Lights2, HIGH) { Serial.print(" Off"); } else if (Lights2, LOW) { Serial.print(" On"); }  Serial.println(); 
  
  Serial.print("Over Head:"); Serial.println(" N/A");
  Serial.println(); 
  Serial.print("......................."); 
  Serial.println();
 
  //if(now.hour() == OnHour1 && now.minute() == OnMin1) {digitalWrite(Lights1, HIGH); }
  //else if (now.hour() == OffHour1 && now.minute() == OffMin1) {digitalWrite(Lights1, LOW);}
  
  //if(now.hour() == OnHour2 && now.minute() == OnMin2) {digitalWrite(Lights2, HIGH); }
  //else if (now.hour() == OffHour2 && now.minute() == OffMin2) {digitalWrite(Lights2, LOW);}
  
  delay(5000);
  
}

Start by always putting each { and } on its own line with nothing else. It makes seeing code blocks so much easier

Here is your code formatted in that way

#include <SimpleDHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> // For I2C
#include <RTClib.h>

//Establishes pin for DHT11 sensor: 
int pinDHT11 = 5;
SimpleDHT11 dht11;

//Establishes the pins for Lights relays.. 
int Lights1 = 6;
int Lights2 = 11;
//int Heater = 
//int airpump = 

//Establishes on & off times for Lights1
const int OnHour1 = 3;  // Hour Value of Lights1 On Time (In 24 hour format)
const int OnMin1 = 57;  // Minute Value of Lights1 On Time 
const int OffHour1 = 3; // Hour Value of Lights1 Off Time (In 24 hour format)
const int OffMin1 = 59; // Minute Value of Lights1 On Time

//Establishes on & off times for Lights2
const int OnHour2 = 3;  // Hour Value of Lights2 On Time (In 24 hour format)
const int OnMin2 = 58;   // Minute Value of Lights2 On Time 
const int OffHour2 = 4; // Hour Value of Lights2 Off Time (In 24 hour format)
const int OffMin2 = 0;  // Minute Value of Lights2 On Time


RTC_DS1307 rtc;  

//DS18b20:
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

int deviceCount = 0;
float tempC;

  LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {
  Serial.begin(9600);
  sensors.begin();
  lcd.init();
  lcd.init();
  lcd.backlight();
  
  // Setting up Lights1 & Lights2 relay switches... 
  pinMode(Lights1, OUTPUT);
  digitalWrite(Lights1, LOW);
  pinMode(Lights2, OUTPUT);
  digitalWrite(Lights2, LOW);
  
  if(! rtc.begin()) {
  Serial.println("Couldn't find RTC");
  while (1);
  }
  
  else {
  // following line sets the RTC to the date & time this sketch was compiled
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
  
  if(! rtc.isrunning()) {
  Serial.println("RTC is NOT running!");
  }
  
}

void loop() 

{
  Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.print("|-.+.-.-.+.-.-.+.-.-.-|"); Serial.println();
  Serial.print("|75 Gallon Paludarium:|"); Serial.println();
  Serial.print("|||||||||||||||||||||||"); Serial.println();
  Serial.print("======================="); Serial.println();
  Serial.println();
  
  DateTime now = rtc.now();
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), 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.println(now.second(), DEC);
  //myFile.close();
  
  byte temperature = 0;
  byte humidity = 0;
  byte data[40] = {0};
  if (dht11.read(pinDHT11, &temperature, &humidity, data)) {
  //Serial.print("Read DHT11 failed"); Serial.println();
  
  sensors.requestTemperatures(); 
  //Serial.println("");
  
}

  //lcd.setCursor(0,0); lcd.print("75 Gallon Paludarium");
  lcd.setCursor(0,0); lcd.print(now.year(), DEC);
  lcd.setCursor(4,0); lcd.print("/");
  lcd.setCursor(5,0); lcd.print(now.month(), DEC);
  lcd.setCursor(7,0); lcd.print('/');
  lcd.setCursor(8,0); lcd.print(now.day(), DEC);
  lcd.setCursor(10,0); lcd.print(" | ");
  lcd.setCursor(12,0); lcd.print(now.hour(), DEC);
  lcd.setCursor(14,0); lcd.print(':');
  lcd.setCursor(15,0); lcd.print(now.minute(), DEC);
  lcd.setCursor(17,0); lcd.print(':');
  lcd.setCursor(18,0); lcd.println(now.second(), DEC);
  lcd.setCursor(0,1); lcd.print("Air:"); lcd.print(sensors.getTempCByIndex(1));
  lcd.setCursor(11,1); lcd.print("RH%:"); lcd.print((int)humidity);
  lcd.setCursor(0,2); lcd.print("h20:"); lcd.print(sensors.getTempCByIndex(0));
  lcd.setCursor(11,2); lcd.print("LPH:");
  lcd.setCursor(0,3); lcd.print("L1:"); if (Lights1, HIGH) { lcd.setCursor(3,3); lcd.print(" Off"); } else {(Lights1, LOW); lcd.print(" On"); }
  lcd.setCursor(12,3); lcd.print("pH:");
  
  Serial.println(".......................");
  Serial.println(); 
  Serial.print("Air Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println();
  Serial.print("Relative Humidity: "); Serial.print((int)humidity); Serial.print("%"); Serial.println();
  
  sensors.requestTemperatures(); 
  
  Serial.print("H20 Temperature: "); Serial.print(sensors.getTempCByIndex(0)); Serial.print("C"); Serial.println(); 
  Serial.print("Flow Rate:"); Serial.print((int)temperature); Serial.println(" Litres/hour"); //Serial.println(); 
  Serial.print("Co2:"); Serial.println(" N/A");
  Serial.print("Heater:"); Serial.println(" N/A");
  Serial.print("Air Pumps:"); Serial.println(" N/A");
  //trying this line... blurg...
  
  
  Serial.print("Aquarium Light:"); 
  if(now.hour() == OnHour1 && now.minute() == OnMin1) 
  {digitalWrite(Lights1, HIGH); Serial.print(" On");}
  else if (now.hour() == OffHour1 && now.minute() == OffMin1) 
  {digitalWrite(Lights1, LOW); Serial.print(" Off");}
  Serial.println(); 
  /*
  if (now.hour() == OnHour1 && now.minute() == OnMin1)
  { 
  Serial.print(" On");}
  else if (now.hour() == OffHour1 && now.minute() == OffMin1){
  Serial.print(" Off");}*/
 
  
  Serial.print("Sump Light:"); 
  if(now.hour() == OnHour2 && now.minute() == OnMin2) 
  {digitalWrite(Lights2, HIGH); Serial.print(" On");}
  else if (now.hour() == OffHour2 && now.minute() == OffMin2) 
  {digitalWrite(Lights2, LOW); Serial.print(" Off");}
  Serial.println(); 
  /*
  if (now.hour() == OnHour2 && now.minute() == OnMin2) 
  {Serial.print(" On");}  
  else if (now.hour() == OffHour2 && now.minute() == OffMin2)
  {Serial.print(" Off");}  */

  //Serial.print("Sump Light:"); if (Lights2, HIGH) { Serial.print(" Off"); } else if (Lights2, LOW) { Serial.print(" On"); }  Serial.println(); 
  
  Serial.print("Over Head:"); Serial.println(" N/A");
  Serial.println(); 
  Serial.print("......................."); 
  Serial.println();
 
  //if(now.hour() == OnHour1 && now.minute() == OnMin1) {digitalWrite(Lights1, HIGH); }
  //else if (now.hour() == OffHour1 && now.minute() == OffMin1) {digitalWrite(Lights1, LOW);}
  
  //if(now.hour() == OnHour2 && now.minute() == OnMin2) {digitalWrite(Lights2, HIGH); }
  //else if (now.hour() == OffHour2 && now.minute() == OffMin2) {digitalWrite(Lights2, LOW);}
  
  delay(5000);
}

Now, with the code block more obvious, is the code for each of your if/else correct and/or do you have code that is being executed unconditionally when it shouldn't be ?

  lcd.setCursor(0,3); lcd.print("L1:"); if (Lights1, HIGH) { lcd.setCursor(3,3); lcd.print(" Off"); } else {(Lights1, LOW); lcd.print(" On"); }

You don't read the state of a pin by saying "(Lights1, HIGH)". You have to call digitalRead() and pass it the pin number:

  lcd.setCursor(0,3); lcd.print("L1:"); 
  lcd.setCursor(3,3); if (digitalRead(Lights1) == HIGH) { lcd.print(" On "); } else {  lcd.print(" Off"); }

Another way to say it is:

  lcd.setCursor(0,3); lcd.print("L1:"); 
  lcd.setCursor(3,3); lcd.print((digitalRead(Lights1) == HIGH) ? " On " : " Off"); }

johnwasser:
You don't read the state of a pin by saying "(Lights1, HIGH)". You have to call digitalRead() and pass it the pin number:

That means that the following control structure is syntactically wrong:

if (Lights1, HIGH)

You have not said so in your post#10?

GolamMostafa:
That means that the following control structure is syntactically wrong:

if (Lights1, HIGH)

actually to be exact - it's syntactically correct (it is a legit C or C++ construct, it will compile (with a warning), but it's semantically wrong (it does not mean what OP thinks).

J-M-L:
actually to be exact - it's syntactically correct (it is a legit C or C++ construct, it will compile (with a warning), but it's semantically wrong (it does not mean what OP thinks).

Yes! It is syntactically correct as it gets compiled; I have learnt it now. I never saw such style in any programming books (15 years old) of my collection. (+).

void setup() 
{
  int Lights1 = 6;
  if (Lights1, HIGH)
  {
    ;
  }
}

void loop() 
{
  
}

You should read about the coma operator

Haven’t you come across for loops with two init statement or iteration expression ?

for (count=0, ptr=&aBuffer; ptr != NULL; count++, ptr++) {
  ...
}

GolamMostafa:
I never saw such style in any programming books (15 years old) of my collection.

Ah!
Newbie.
That explains a very great deal.