LCD screen goes blank no light after the program is loaded

My Screen goes out after the program is loaded.
I am sure it is a syntax problem or something but I cant find it.
Would someone try this on your uno board and see if it gives the same result?
Does anyone see what I have done wrong? I am using a shield LCD that works fine until I get to this point.

The Program

#include <LiquidCrystal.h>
LiquidCrystal
lcd(8, 9, 4, 5,6, 7);

int h = 17; //Here h= is the hours for the time of day it could be 1-24//
int m =0; //here m= is the minutes for the time of day it could be 1-59//
int s=0; // here s= is the seconds for the time of day usually left at 0//

int hao = 17; //Here h = is the hours for the Light on it could be 1-24//
int mao = 0; //here m = is the minutes for the Light on it could be 1-59//

int haf = 17; //Here h = is the hours for the Light off it could be 1-24//
int maf = 1; //here m = is the minutes for the Light off it could be 1-59//

int hwateron= 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mwateron=01;//here m= is the minutes for the water Pump on it could be 1-59//

int hwateroff= 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mwateroff=02; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumpon = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumpon =03; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoff=04; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponn =5; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpofff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpofff=6; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponnn= 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponnn=7; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoffff= 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoffff=8; //here m= is the minutes for the water Pump off it could be 1-59//

int hgasinjecton = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mgasinjecton =9; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hgasinjectoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mgasinjectoff =10; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//

int hExtraon = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mExtraon =11; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hExtraoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mExtraoff =12; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//
int fert = 17;

void setup()
{
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(10 ,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode( A0 ,OUTPUT);
pinMode( A1 ,OUTPUT);
pinMode( A2 ,OUTPUT);
pinMode( A3 ,OUTPUT);
pinMode( A4 ,OUTPUT);
pinMode( A5 ,OUTPUT);
}

void loop()

{

if ((h == hwateron)and(m == mwateron)) digitalWrite(1, HIGH),digitalWrite(2,HIGH);
if ((h == hwateroff)and(m == mwateroff)) digitalWrite(1,LOW),digitalWrite(2,LOW);

if ((h == hpumpon)and(m == mpumpon)) digitalWrite(3, HIGH),digitalWrite(11,HIGH);
if ((h == hpumpoff)and(m == mpumpoff)) digitalWrite(3,LOW),digitalWrite(11,LOW);

if ((h == hpumponn)and(m == mpumponn)) digitalWrite( A0 , HIGH),digitalWrite( A1 ,HIGH);
if ((h == hpumpofff)and(m == mpumpofff)) digitalWrite( A0 ,LOW),digitalWrite( A1 ,LOW);

if ((h == hpumponnn)and(m == mpumponnn)) digitalWrite( A2 , HIGH),digitalWrite( A3 ,HIGH);
if ((h == hpumpoffff)and(m == mpumpoffff)) digitalWrite( A2 ,LOW),digitalWrite( A3 ,LOW);

if ((h == hgasinjecton)and(m == mgasinjecton)) digitalWrite( A4 , HIGH),digitalWrite(10,HIGH);
if ((h == hgasinjectoff)and(m == mgasinjectoff)) digitalWrite( A4 ,LOW),digitalWrite(10,LOW);

if ((h == hExtraon)and(m == mExtraon)) digitalWrite(11, HIGH),digitalWrite(12,HIGH);
if ((h == hExtraoff)and(m == mExtraoff)) digitalWrite(11,LOW),digitalWrite(12,LOW);

if ((h == hao)and(m == mao)) (digitalWrite( A5 , HIGH)), (digitalWrite( 13 ,HIGH));

if ((h == haf)and(m == maf)) (digitalWrite( A5 ,LOW)),(digitalWrite( 13 ,LOW));

lcd.begin(16, 2);
lcd.setCursor(0,1);
lcd.clear();
lcd.print("TIME:");
lcd.print(h);
lcd.print(":");
lcd.print(m);
lcd.print(":");
lcd.print(s);

}

Look at how your code is displayed in the forum.

You didn't use code tags to post your code. It's important that you use them - if you don't, the forum software sometimes interprets sequences of characters in the code as directives to format text in some way. It won't display those sequences, and it will unexpectedly reformat the rest of the text. When that happens, and someone tries to copy your code and paste it into the IDE, it often throws an error, and readers will complain that the code fails to compile. Using code tags also makes it easier to read, and can be copied with a single mouse click.

Unless the sketch is too large, it's better if you post your code, rather than attach it. When it's attached, we have to download it, open it in a text editor, then copy it to the IDE. It's much easier to just view the code in your post.

The code tags make the code look

like this

when posting source code files.
If you have already posted without using code tags, open your message and select "modify" from the pull down menu labelled, "More", at the lower left corner of the message. Before posting the code, use Ctrl-T in the IDE to reformat the code in a standard format, which makes it easier for us to read. Highlight your code by selecting it (it turns blue), and then click on the "</>" icon at the upper left hand corner. Click on the "Save" button. Code tags can also be inserted manually in the forum text using the [code] and [/code] metatags.

When you are finished that, please read this post:

How to use this forum - please read.

if ((h == hwateron)and(m == mwateron)) { digitalWrite(1, HIGH); digitalWrite(2,HIGH); }

// and so on..

#include <LiquidCrystal.h>
LiquidCrystal
lcd(8, 9, 4, 5,6, 7);

int h = 17; //Here h= is the hours for the time of day it could be 1-24//
int m =0; //here m= is the minutes for the time of day it could be 1-59//
int s=0; // here s= is the seconds for the time of day usually left at 0//

int hao = 17; //Here h = is the hours for the Light on it could be 1-24//
int mao = 0; //here m = is the minutes for the Light on it could be 1-59//

int haf = 17; //Here h = is the hours for the Light off it could be 1-24//
int maf = 1; //here m = is the minutes for the Light off it could be 1-59//

int hwateron= 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mwateron=01;//here m= is the minutes for the water Pump on it could be 1-59//

int hwateroff= 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mwateroff=02; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumpon = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumpon =03; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoff=04; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponn =5; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpofff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpofff=6; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponnn= 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponnn=7; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoffff= 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoffff=8; //here m= is the minutes for the water Pump off it could be 1-59//

int hgasinjecton = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mgasinjecton =9; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hgasinjectoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mgasinjectoff =10; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//

int hExtraon = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mExtraon =11; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hExtraoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mExtraoff =12; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//
int fert = 17;

void setup()
{
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(10 ,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode( A0 ,OUTPUT);
pinMode( A1 ,OUTPUT);
pinMode( A2 ,OUTPUT);
pinMode( A3 ,OUTPUT);
pinMode( A4 ,OUTPUT);
pinMode( A5 ,OUTPUT);
}

void loop()

{

if ((h == hwateron)and(m == mwateron)) digitalWrite(1, HIGH),digitalWrite(2,HIGH);
if ((h == hwateroff)and(m == mwateroff)) digitalWrite(1,LOW),digitalWrite(2,LOW);

if ((h == hpumpon)and(m == mpumpon)) digitalWrite(3, HIGH),digitalWrite(11,HIGH);
if ((h == hpumpoff)and(m == mpumpoff)) digitalWrite(3,LOW),digitalWrite(11,LOW);

if ((h == hpumponn)and(m == mpumponn)) digitalWrite( A0 , HIGH),digitalWrite( A1 ,HIGH);
if ((h == hpumpofff)and(m == mpumpofff)) digitalWrite( A0 ,LOW),digitalWrite( A1 ,LOW);

if ((h == hpumponnn)and(m == mpumponnn)) digitalWrite( A2 , HIGH),digitalWrite( A3 ,HIGH);
if ((h == hpumpoffff)and(m == mpumpoffff)) digitalWrite( A2 ,LOW),digitalWrite( A3 ,LOW);

if ((h == hgasinjecton)and(m == mgasinjecton)) digitalWrite( A4 , HIGH),digitalWrite(10,HIGH);
if ((h == hgasinjectoff)and(m == mgasinjectoff)) digitalWrite( A4 ,LOW),digitalWrite(10,LOW);

if ((h == hExtraon)and(m == mExtraon)) digitalWrite(11, HIGH),digitalWrite(12,HIGH);
if ((h == hExtraoff)and(m == mExtraoff)) digitalWrite(11,LOW),digitalWrite(12,LOW);

if ((h == hao)and(m == mao)) (digitalWrite( A5 , HIGH)), (digitalWrite( 13 ,HIGH));

if ((h == haf)and(m == maf)) (digitalWrite( A5 ,LOW)),(digitalWrite( 13 ,LOW));

lcd.begin(16, 2);
lcd.setCursor(0,1);
lcd.clear();
lcd.print("TIME:");
lcd.print(h);
lcd.print(":");
lcd.print(m);
lcd.print(":");
lcd.print(s);

}


Was that done correctly? :confused:


#include <LiquidCrystal.h>
LiquidCrystal
lcd(8, 9, 4, 5, 6, 7);

int h = 17; //Here h= is the hours for the time of day it could be 1-24//
int m = 0; //here m= is the minutes for the time of day it could be 1-59//
int s = 0; // here s= is the seconds for the time of day usually left at 0//

int hao = 17; //Here h = is the hours for the Light on it could be 1-24//
int mao = 0; //here m = is the minutes for the Light on it could be 1-59//

int haf = 17; //Here h = is the hours for the Light off it could be 1-24//
int maf = 1; //here m = is the minutes for the Light off it could be 1-59//

int hwateron = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mwateron = 01; //here m= is the minutes for the water Pump on it could be 1-59//

int hwateroff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mwateroff = 02; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumpon = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumpon = 03; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoff = 04; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponn = 5; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpofff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpofff = 6; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponnn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponnn = 7; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoffff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int mpumpoffff = 8; //here m= is the minutes for the water Pump off it could be 1-59//

int hgasinjecton = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mgasinjecton = 9; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hgasinjectoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mgasinjectoff = 10; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//

int hExtraon = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mExtraon = 11; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hExtraoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mExtraoff = 12; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//
int fert = 17;

void setup()
{
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(10 , OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode( A0 , OUTPUT);
pinMode( A1 , OUTPUT);
pinMode( A2 , OUTPUT);
pinMode( A3 , OUTPUT);
pinMode( A4 , OUTPUT);
pinMode( A5 , OUTPUT);
}

void loop()

{

if ((h == hwateron) and (m == mwateron)) digitalWrite(1, HIGH), digitalWrite(2, HIGH);
if ((h == hwateroff) and (m == mwateroff)) digitalWrite(1, LOW), digitalWrite(2, LOW);

if ((h == hpumpon) and (m == mpumpon)) digitalWrite(3, HIGH), digitalWrite(11, HIGH);
if ((h == hpumpoff) and (m == mpumpoff)) digitalWrite(3, LOW), digitalWrite(11, LOW);

if ((h == hpumponn) and (m == mpumponn)) digitalWrite( A0 , HIGH), digitalWrite( A1 , HIGH);
if ((h == hpumpofff) and (m == mpumpofff)) digitalWrite( A0 , LOW), digitalWrite( A1 , LOW);

if ((h == hpumponnn) and (m == mpumponnn)) digitalWrite( A2 , HIGH), digitalWrite( A3 , HIGH);
if ((h == hpumpoffff) and (m == mpumpoffff)) digitalWrite( A2 , LOW), digitalWrite( A3 , LOW);

if ((h == hgasinjecton) and (m == mgasinjecton)) digitalWrite( A4 , HIGH), digitalWrite(10, HIGH);
if ((h == hgasinjectoff) and (m == mgasinjectoff)) digitalWrite( A4 , LOW), digitalWrite(10, LOW);

if ((h == hExtraon) and (m == mExtraon)) digitalWrite(11, HIGH), digitalWrite(12, HIGH);
if ((h == hExtraoff) and (m == mExtraoff)) digitalWrite(11, LOW), digitalWrite(12, LOW);

if ((h == hao) and (m == mao)) (digitalWrite( A5 , HIGH)), (digitalWrite( 13 , HIGH));

if ((h == haf) and (m == maf)) (digitalWrite( A5 , LOW)), (digitalWrite( 13 , LOW));

lcd.begin(16, 2);
lcd.setCursor(0, 1);
lcd.clear();
lcd.print("TIME:");
lcd.print(h);
lcd.print(":");
lcd.print(m);
lcd.print(":");
lcd.print(s);

}

syntax is not correct:

Try:
if ( (test1) and (test2)) { do this ; do this too; and this one; }

// that is three statement run if both tests pass

Was that done correctly?

No. Select the text of the program then click the code tags icon. The code tags go around the code not at the start. Here is your code auto formatted and in code tags

#include <LiquidCrystal.h>
LiquidCrystal
lcd(8, 9, 4, 5, 6, 7);

int h = 17; //Here h= is the hours for the time of day it could be 1-24//
int m = 0; //here m= is the minutes for the time of day it could be 1-59//
int s = 0; // here s= is the seconds for the time of day usually left at 0//

int hao = 17; //Here h = is the hours for the Light on it could be 1-24//
int mao = 0; //here m = is the minutes for the Light on it could be 1-59//


int haf = 17; //Here h = is the hours for the Light off it could be 1-24//
int maf = 1; //here m = is the minutes for the Light off it could be 1-59//

int hwateron = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int  mwateron = 01; //here m= is the minutes for the water Pump on it could be 1-59//

int hwateroff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int  mwateroff = 02; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumpon = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumpon = 03; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int  mpumpoff = 04; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponn = 5; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpofff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int  mpumpofff = 6; //here m= is the minutes for the water Pump off it could be 1-59//

int hpumponnn = 17; //Here h= is the hours for the water Pump on it could be 1-24//
int mpumponnn = 7; //here m= is the minutes for the water Pump on it could be 1-59//
int hpumpoffff = 17; //Here h= is the hours for the water Pump off it could be 1-24//
int  mpumpoffff = 8; //here m= is the minutes for the water Pump off it could be 1-59//

int hgasinjecton = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mgasinjecton = 9; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hgasinjectoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mgasinjectoff = 10; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//

int hExtraon = 17; //Here h= is the hours for the CO2 Pump/Valve on it could be 1-24//
int mExtraon = 11; //here m= is the minutes for the CO2 Pump/Valve on it could be 1-59//
int hExtraoff = 17; //Here h= is the hours for the CO2 Pump/Valve off it could be 1-24//
int mExtraoff = 12; //here m= is the minutes for the CO2 Pump/Valve off it could be 1-59//
int fert = 17;

void setup()
{
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(10  , OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode( A0 , OUTPUT);
  pinMode( A1  , OUTPUT);
  pinMode( A2  , OUTPUT);
  pinMode( A3 , OUTPUT);
  pinMode( A4  , OUTPUT);
  pinMode( A5  , OUTPUT);
}

void loop()
{
  if ((h == hwateron) and (m == mwateron)) digitalWrite(1, HIGH), digitalWrite(2, HIGH);
  if ((h == hwateroff) and (m == mwateroff)) digitalWrite(1, LOW), digitalWrite(2, LOW);
  if ((h == hpumpon) and (m == mpumpon)) digitalWrite(3, HIGH), digitalWrite(11, HIGH);
  if ((h == hpumpoff) and (m == mpumpoff)) digitalWrite(3, LOW), digitalWrite(11, LOW);
  if ((h == hpumponn) and (m == mpumponn)) digitalWrite(  A0     , HIGH), digitalWrite( A1     , HIGH);
  if ((h == hpumpofff) and (m == mpumpofff)) digitalWrite( A0      , LOW), digitalWrite(  A1        , LOW);
  if ((h == hpumponnn) and (m == mpumponnn)) digitalWrite(   A2    , HIGH), digitalWrite( A3      , HIGH);
  if ((h == hpumpoffff) and (m == mpumpoffff)) digitalWrite( A2      , LOW), digitalWrite( A3      , LOW);
  if ((h == hgasinjecton) and (m == mgasinjecton)) digitalWrite(   A4    , HIGH), digitalWrite(10, HIGH);
  if ((h == hgasinjectoff) and (m == mgasinjectoff)) digitalWrite(  A4      , LOW), digitalWrite(10, LOW);
  if ((h == hExtraon) and (m == mExtraon)) digitalWrite(11, HIGH), digitalWrite(12, HIGH);
  if ((h == hExtraoff) and (m == mExtraoff)) digitalWrite(11, LOW), digitalWrite(12, LOW);
  if ((h == hao) and (m == mao)) (digitalWrite(   A5    , HIGH)), (digitalWrite(    13      , HIGH));
  if ((h == haf) and (m == maf)) (digitalWrite(    A5     , LOW)), (digitalWrite(       13      , LOW));
  lcd.begin(16, 2);
  lcd.setCursor(0, 1);
  lcd.clear();
  lcd.print("TIME:");
  lcd.print(h);
  lcd.print(":");
  lcd.print(m);
  lcd.print(":");
  lcd.print(s);
}

Note that I have not corrected the errors in it pointed out above.

Hi

The main reason your display is blank is that you are doing a lcd.clear() instruction every time you go through the loop which is roughly every few tens of microseconds. Try the following:-

  1. Move the lcd.begin() call from loop() to setup() (it only needs to be called once, not every time round loop()).

  2. Create a global unsigned long variable called something like lastRefresh.

  3. Change you code in loop to look something like this

    if (millis() > (lastRefresh + 500)) {   // If its more than 500ms since we last updated the display update it
       lcd.clear();                               
       lcd.setCursor(0,1);          // Moves the cursor to the start of the second line
       lcd.print("Time: ");
       lcd.print(h);
       lcd.print(":");
       if (m < 10) lcd.print("0");  // Add a leading 0
       lcd.print(m);
       lcd.print(":");
       if (s < 10) lcd.print("0");   // Add a leading 0
       lcd.print(s);
       lastRefresh = millis();       // Restart the refresh counter
    }

You probably don't want to update the display more often than every half second.

Ian