LCD troubles

Hello, I just bought a LCD off of maker shed for an Arduino project I am working on, and when I upload the sketch(which uses the LCD) It will display the "initializing...", which is in void setup, but then It is supposed to say, "please swipe your card" int void loop. But what happens is, when the LCD is supposed to say " please swipe card" it says, "please sw" very dark so and flickering so that I can barely see it. All of the other LCD functions are working properly though Now I just uploaded the sketch again, and it says "please swipe your card" like it should, but it is still much darker text so it is harder to read.
Here is my code if anyone will help me.

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // initialize the library with the numbers of the interface pins

#define TAG_LEN 12
char tag[12] = {'0', '1', '0', '0', '4', 'D', 'D', '1', 'D', '3'}; //tag 1
char tag2[12] = {'3', '6', '0', '0', '7', '8', '9', 'B', 'B', '5'}; //tag 2
char code[12];
int bytesread = 0;
//Connections to be made:
int ledPin = 13; // Connect LED to pin 13
int rfidPin = 2; // RFID enable pin connected to digital pin 2
//Connect SOUT Pin to pin 0, does not need to be defined because 0 is the default RX pin
int val=0;
void setup() {
lcd.begin(16, 2); // set up the LCD's number of rows and columns
lcd.print("Initializing...");
delay (1000);
lcd.clear(); //Clears LCD
Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
pinMode(ledPin,OUTPUT); // Set ledPin to output

digitalWrite(rfidPin, LOW); // Activate the RFID reader
}

 void loop() {
digitalWrite(ledPin,LOW); //LED off
digitalWrite(rfidPin, LOW); // Activate the RFID reader
lcd.setCursor(0, 0);
 lcd.print("  Please Swipe");
 lcd.setCursor(0, 1);
 lcd.print("   Your Card");
  if(Serial.available() > 0) {    // if data available from reader
    if((val = Serial.read()) == 10) {   // check for header
bytesread = 0;
while(bytesread<10) {  // read 10 digit code
 if( Serial.available() > 0) {
   val = Serial.read();
   if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break;     // stop reading
   }
   code[bytesread] = val;   // add the digit
   bytesread++; // ready to read next digit
digitalWrite(rfidPin, HIGH); //Turns off RFID reader, THIS IS IMPORTANT so it doesn't double read the card
 }
}

if(bytesread >= 10) {  // if 10 digit read is complete
 
if(strcmp(code, tag) == 0) {
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print(" Access Granted");
 lcd.setCursor(0, 1);
 lcd.println(code);
 delay (1500);
 lcd.setCursor(0, 1);
 lcd.print("Jonnyblanch  ");
 digitalWrite(ledPin,HIGH);
 Serial.print("Tag matches: ");
 Serial.println(code);
           //digitalWrite(ledPin,HIGH);
           digitalWrite(rfidPin, HIGH);
            delay(2000);   // wait for a second or two
           return;                   //Go to the top, skip the bottom
         }
         if(strcmp(code, tag2) == 0) {
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print(" Access Granted");
 lcd.setCursor(0, 1);
 lcd.println(code);
 delay (1500);
 lcd.setCursor(0, 1);
 lcd.print("Hector Lopez");
         digitalWrite(ledPin,HIGH);
  Serial.print("Tag matches: ");
  Serial.println(code);
           digitalWrite(ledPin,HIGH);
           digitalWrite(rfidPin, HIGH);
            delay(2000);     // wait for a second
           return;
  
}
else {
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print("Access Denied");
 lcd.setCursor(0, 1);
 lcd.println(code);
  Serial.print(code);
  Serial.println(" does not match");
           digitalWrite(rfidPin, HIGH);
           
}


}
bytesread = 0;
    delay(2000);     // wait for a second
        digitalWrite(ledPin,LOW);    
    }
  }
}

Use the Arduino IDE's Auto Format Tool (Tools > Auto Format) and repost the code to make it readable.

The flicker is probably because you're printing "please swipe" over and over again.
Yes, your code format is eye-hurting.

Can you reformat your sketch to make the indentations readable? I tried reading it, and started to get a headache.
Also, we don't know which LCD you bought. Can you give use the URL to which one you bought?

Thanks, Jack

Sorry about the indentations, I didn't know you could auto format it.

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // initialize the library with the numbers of the interface pins

#define TAG_LEN 12
char tag[12] = {
  '0', '1', '0', '0', '4', 'D', 'D', '1', 'D', '3'}; //tag 1
char tag2[12] = {
  '3', '6', '0', '0', '7', '8', '9', 'B', 'B', '5'}; //tag 2
char code[12];
int bytesread = 0;
//Connections to be made:
int ledPin = 13; // Connect LED to pin 13
int rfidPin = 2; // RFID enable pin connected to digital pin 2
//Connect SOUT Pin to pin 0, does not need to be defined because 0 is the default RX pin
int val=0;
void setup() {
  lcd.begin(16, 2); // set up the LCD's number of rows and columns
  lcd.print("Initializing...");
  delay (1000);

  Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
  pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
  pinMode(ledPin,OUTPUT); // Set ledPin to output

  digitalWrite(rfidPin, LOW); // Activate the RFID reader
}

void loop() {
  digitalWrite(ledPin,LOW); //LED off
  digitalWrite(rfidPin, LOW); // Activate the RFID reader
  lcd.clear(); //Clears LCD
  lcd.setCursor(0, 0);
  lcd.print("  Please Swipe");
  //lcd.setCursor(0, 1);
  //lcd.print("   Your Card");
  if(Serial.available() > 0) {	    // if data available from reader
    if((val = Serial.read()) == 10) {   // check for header
      bytesread = 0;
      while(bytesread<10) {		  // read 10 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
            break;			     // stop reading
          }
          code[bytesread] = val;	   // add the digit
          bytesread++;			 // ready to read next digit
          digitalWrite(rfidPin, HIGH); //Turns off RFID reader, THIS IS IMPORTANT so it doesn't double read the card
        }
      }

      if(bytesread >= 10) {		  // if 10 digit read is complete

        if(strcmp(code, tag) == 0) {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(" Access Granted");
          lcd.setCursor(0, 1);
          lcd.println(code);
          delay (1500);
          lcd.setCursor(0, 1);
          lcd.print("Jonnyblanch  ");
          digitalWrite(ledPin,HIGH);
          Serial.print("Tag matches: ");
          Serial.println(code);
          //digitalWrite(ledPin,HIGH);
          digitalWrite(rfidPin, HIGH);
          delay(2000);	     // wait for a second or two
          return;                   //Go to the top, skip the bottom
        }
        if(strcmp(code, tag2) == 0) {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(" Access Granted");
          lcd.setCursor(0, 1);
          lcd.println(code);
          delay (1500);
          lcd.setCursor(0, 1);
          lcd.print("Hector Lopez");
          digitalWrite(ledPin,HIGH);
          Serial.print("Tag matches: ");
          Serial.println(code);
          digitalWrite(ledPin,HIGH);
          digitalWrite(rfidPin, HIGH);
          delay(2000);	     // wait for a second
          return;

        }
        else {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Access Denied");
          lcd.setCursor(0, 1);
          lcd.println(code);
          Serial.print(code);
          Serial.println(" does not match");
          digitalWrite(rfidPin, HIGH);

        }


      }
      bytesread = 0;
      delay(2000);	     // wait for a second
      digitalWrite(ledPin,LOW);    
    }
  }
}

Also, AWOL, I get what you are saying about it printing "please swipe" over and over again, but I'm not sure where else to put it. I tried putting it after the "initializing" in the setup, but then it wont reappear after a card is swiped.

So I tried moving the "please swipe" bit of code around, so that it is not constantly printing that to the LCD, but the text is still very dark and hard to read.

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // initialize the library with the numbers of the interface pins

#define TAG_LEN 12
char tag[12] = {
  '0', '1', '0', '0', '4', 'D', 'D', '1', 'D', '3'}; //tag 1
char tag2[12] = {
  '3', '6', '0', '0', '7', '8', '9', 'B', 'B', '5'}; //tag 2
char code[12];
int bytesread = 0;
//Connections to be made:
int ledPin = 13; // Connect LED to pin 13
int rfidPin = 2; // RFID enable pin connected to digital pin 2
//Connect SOUT Pin to pin 0, does not need to be defined because 0 is the default RX pin
int val=0;
void setup() {
  lcd.begin(16, 2); // set up the LCD's number of rows and columns
  lcd.print("Initializing...");
  delay (2000);
  lcd.clear(); //Clears LCD
  lcd.setCursor(0, 0);
  lcd.print("  Please Swipe");
  lcd.setCursor(0, 1);
  lcd.print("   Your Card");

  Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
  pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
  pinMode(ledPin,OUTPUT); // Set ledPin to output

  digitalWrite(rfidPin, LOW); // Activate the RFID reader
}

void loop() {
  digitalWrite(ledPin,LOW); //LED off
  digitalWrite(rfidPin, LOW); // Activate the RFID reader
  //lcd.clear(); //Clears LCD
  //lcd.setCursor(0, 0);
  //lcd.print("  Please Swipe");
  //lcd.setCursor(0, 1);
  //lcd.print("   Your Card");
  if(Serial.available() > 0) {	    // if data available from reader
    if((val = Serial.read()) == 10) {   // check for header
      bytesread = 0;
      while(bytesread<10) {		  // read 10 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
            break;			     // stop reading
          }
          code[bytesread] = val;	   // add the digit
          bytesread++;			 // ready to read next digit
          digitalWrite(rfidPin, HIGH); //Turns off RFID reader, THIS IS IMPORTANT so it doesn't double read the card
        }
      }

      if(bytesread >= 10) {		  // if 10 digit read is complete

        if(strcmp(code, tag) == 0) {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(" Access Granted");
          lcd.setCursor(0, 1);
          lcd.println(code);
          delay (1500);
          lcd.setCursor(0, 1);
          lcd.print("Jonnyblanch  ");
          digitalWrite(ledPin,HIGH);
          Serial.print("Tag matches: ");
          Serial.println(code);
          //digitalWrite(ledPin,HIGH);
          digitalWrite(rfidPin, HIGH);
          delay(2000);
          lcd.clear(); //Clears LCD
          lcd.setCursor(0, 0);
          lcd.print("  Please Swipe");
          lcd.setCursor(0, 1);
          lcd.print("   Your Card");	     // wait for a second or two
          return;                   //Go to the top, skip the bottom
        }
        if(strcmp(code, tag2) == 0) {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print(" Access Granted");
          lcd.setCursor(0, 1);
          lcd.println(code);
          delay (1500);
          lcd.setCursor(0, 1);
          lcd.print("Hector Lopez");
          digitalWrite(ledPin,HIGH);
          Serial.print("Tag matches: ");
          Serial.println(code);
          digitalWrite(ledPin,HIGH);
          digitalWrite(rfidPin, HIGH);
          delay(2000);	     // wait for a second
          return;

        }
        else {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Access Denied");
          lcd.setCursor(0, 1);
          lcd.println(code);
          Serial.print(code);
          Serial.println(" does not match");
          digitalWrite(rfidPin, HIGH);

        }


      }
      bytesread = 0;
      delay(2000);	     // wait for a second
      digitalWrite(ledPin,LOW);    
    }
  }
}

Which LCD did you buy?
Are you able to get it to work with any of the example programs?
If it is printing, but dark, and hard to read, try adjusting the variable resistor, for contrast.

Let us know, good luck, Jack

Sorry I didn't memtion the LCD, Arduino | Arduino Microcontroller - Maker Shed . I tried adjusting the potentiometer and it is the same. The LCD works fin the the Helloworld example. I'm sorry I didn't get back sooner, I thought I posted this message earlier, but I didn't hit post.

Thanks

Did you turn on the backlight?

It should be pin 15 or 16 of the LCD. Not sure what pin of the board. Was digital pin 10 on the one I bought.
So
digitalWrite(10, HIGH);
Did the trick for me.

If the backlight is on then I have no idea what you mean by text being dim.

Pins 16 and 15 on the LCD are the backlight's ground and power. I connected them to the ground and power rails of my breadboard. When I say " darker text" I mean that normal text is completely white with a solid blue background, while this text is a darker gray on a blue background.

You say the LCD works fine with the "hello world" example sketch..
Was that last week, or have you tried it again lately. If it works with the example now, but not with your sketch, that should be telling us something. What is the differences.

My LCD works with the hello world example sketch now. And within my sketch IT displays almost everything perfectly, except for this "Please Swipe" part. This most likely tells me that it is a problem with my code, not the hardware.

Maybe you can start moving parts of your code, over into the "hello world" sketch, and see if you can isolate it.

In my project I am using a Paralax RFID reader, http://www.parallax.com/tabid/768/productid/114/default.aspx . And what it does is it reads a swiped card and then displays "Access Granted" on an LCD. On this RFID reader there is a little light that is red when it is in an off state, and green when a card is swiped or for a second while a upload a new sketch to my Arduino. The only time that the LCD is having trouble is with the "Please Swipe" portion. I have noticed that while I upload a new sketch and the RFID reader's light is green, the "please swipe" text looks perfectly fine. The only time that the RFID reader's light is red is while the "please swipe" text is up. So i'm thinking tha tmy problem has something to do with my RFID reader. I don't know is its using up too much power or what, but it has something to do wit that.

Cole, look at the Arduino Playground - PRFID page.
Code for using the Arduino with the Parallax RFID reader
Have you tried that example code yet?

This code is almost identical to mine, except for the LCD part. The RFID works perfectly, it's just the LCD that seems to have trouble working with the RFID reader.

You say "This code is almost identical to mine", but have you loaded it and run it with success? Try it!
You seem to think it is when both devices are run together. What data pins do each device use, any overlap?
There must be a solution to this problem, just needs patients, and lots of testing.

I tested my RFID reader with the example sketch you sent me and it worked fine. Then I added a couple of lines to add a LCD and it still does the same thing as my sketch.

  // RFID reader for Arduino 
    // Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan> 
    // Modified for Arudino by djmatic
    #include <LiquidCrystal.h>
    LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // initialize the library with the numbers of the interface pins
    
    int  val = 0; 
    char code[10]; 
    int bytesread = 0; 
    
    void setup() { 
     lcd.begin(16, 2); // set up the LCD's number of rows and columns
     lcd.print("  Please Swipe");
     lcd.setCursor(0, 1);
     lcd.print("   Your Card");
     Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
     pinMode(2,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin 
     digitalWrite(2, LOW);                  // Activate the RFID reader
    }  
    
    
     void loop() { 
    
      if(Serial.available() > 0) {          // if data available from reader 
        if((val = Serial.read()) == 10) {   // check for header 
          bytesread = 0; 
          while(bytesread<10) {              // read 10 digit code 
            if( Serial.available() > 0) { 
              val = Serial.read(); 
              if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading 
                break;                       // stop reading 
              } 
              code[bytesread] = val;         // add the digit           
              bytesread++;                   // ready to read next digit  
            } 
          } 
          if(bytesread == 10) {              // if 10 digit read is complete 
            Serial.print("TAG code is: ");   // possibly a good TAG 
            Serial.println(code);            // print the TAG code 
          } 
          bytesread = 0; 
          digitalWrite(2, HIGH);                  // deactivate the RFID reader for a moment so it will not flood
               delay(1500);                       // wait for a bit 
               digitalWrite(2, LOW);                  // Activate the RFID reader
        } 
      } 
    } 
    
    // extra stuff
    // digitalWrite(2, HIGH);             // deactivate RFID reader

What data pins do each device use, any overlap?

The LCD uses pins 7-12 and the RFID reader uses pins 2 and 0, so no overlap.