title: Arduino 16*2 LCD displaying random characters instead of expected text
body: <p>I'm trying to display some data to my 16*2 LCD module but there are some random characters being shown. I have some simple code that I used to test my LCD display and it works perfectly. Code:</p>
  
  <pre><code>#include&lt;LiquidCrystal.h&gt;
  
  
  // initializing pins - RS, E, rest of data pins
  LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
  
  void setup() {
    lcd.begin(16, 2);
  }
  
  void loop() {
    lcd.print("Testing");   // thats the top row string
    delay(1800);
  
    lcd.setCursor(2, 1);   // move to the 2nd row, 1st col
    lcd.print("Display this!");
    delay(1800);
    lcd.clear();
  
    lcd.setCursor(7, 1);
    delay(400);
    lcd.blink();
    lcd.setCursor(6, 1);
    delay(400);
    lcd.setCursor(5, 1);
    delay(400);
    lcd.setCursor(4, 1);
    delay(400);
    lcd.setCursor(3, 1);
    delay(400);
    lcd.setCursor(2, 1);
    delay(400);
    lcd.setCursor(1, 1);
    delay(400);
    lcd.setCursor(0, 1);
    lcd.noBlink();
    lcd.print("Silly Isn't It?");
  
    lcd.cursor();
    delay(1800);
    lcd.noCursor();
  
    lcd.clear();
  }
  </code></pre>
  
  <p>However, I have more things on the breadboard now - the LCD, micro SD reader, potentiometer and an LM35 temperature sensor
  and this my code:</p>
  
  <pre><code>#include&lt;LiquidCrystal.h&gt;
  #include &lt;SD.h&gt;
  #include &lt;SPI.h&gt;
  
  ////////// LCD
  //initializing pins - RS, E, rest of data pins
  LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
  
  
  const int CS_PIN = 10;
  const int POW_PIN = 8;
  int refreshRate = 2000;       // for reading vals
  
  ////////// LEDs
  int ledPinR = 11;
  int ledPinG = 12;
  int ledPinY = 13;
  
  ////////// LM35
  float temp;
  int tempPin = A0;
  
  void setup() {
  
    ////////// LED
    pinMode(ledPinR, OUTPUT);
    pinMode(ledPinG, OUTPUT);
    pinMode(ledPinY, OUTPUT);
  
    ////////// LCD
    lcd.begin(16, 2);
    lcd.print("please wait...");   //thats the top row string
    delay(2000);
    lcd.clear();
    lcd.blink();
  
  
    ////////// SD
    Serial.begin(9600);
    Serial.println("\nNow Initializing SD card...");
    pinMode(CS_PIN, OUTPUT);
    pinMode(POW_PIN, OUTPUT);
    digitalWrite(POW_PIN, HIGH);
  
    if(!SD.begin(CS_PIN)){
      Serial.println("\nSomething went wrong. Probably card failure, card format, or something else.");
      return;
    }
  
    Serial.println("\nCard ready!");
    File commandFile =  SD.open("tempLevels.txt");
  
    if(commandFile){
      Serial.println("\nNow Reading Command File...");
  
      while(commandFile.available())
      {
        refreshRate = commandFile.parseInt();
      }
  
      Serial.print("\nTapiwa, the refresh rate is: ");
      Serial.print(refreshRate);
      Serial.print(" ms");
  
      commandFile.close();
    }
  
    else{
      Serial.println("Oops! Failing to read command file!");
      return;
    }
  }
  
  void loop() {
  
    ////////// LM35
    temp = analogRead(tempPin);
    float mV = (temp / 1024.0) * 5000;
    float tempVal = mV / 10;
  
    Serial.println("\nTemperature is: ");
    Serial.println(tempVal);  
  
    File dataFile =  SD.open("log.csv", FILE_WRITE);          // dont know about that .csv format
  
    if(dataFile)
    {
      dataFile.print("\nTemperature is: ");
      dataFile.print(tempVal);
      dataFile.println("Deg");
      dataFile.close();
  
      Serial.println("\nSaved in DataFile &gt;&gt; Temperature is: ");
      Serial.print(tempVal);
    }
  
    else
    {
      Serial.println("DataFile error! Reading not saved");
      Serial.println("Could not open log file! Not on SD card!");
    }
  
    lcd.print("Temp: ");
    lcd.setCursor(2, 1);   // 2nd row, 1st col
    lcd.print(tempVal);
    delay(2000);
  
    lcd.clear();
    delay(refreshRate);
  }
  </code></pre>
  
  <p>I'm getting the results in the serial monitor but the LCD displays random characters which resemble encrypted text. Where did I go wrong?
  I've looked at at multiple posts on this site and other sites but they are not that useful:</p>
  
  <p><a href="https://arduino.stackexchange.com/questions/16165/why-does-my-lcd-display-random-characters">This one made sense but not useful in my case</a>.</p>
  
  <p><a href="https://www.reddit.com/r/arduino/comments/2nexb7/why_do_i_get_these_random_characters/" rel="nofollow noreferrer">This one too!</a>.</p>
  
  <p><a href="http://forum.arduino.cc/index.php?topic=111401.0" rel="nofollow noreferrer">And this one</a></p>