LCD Random Characters

I'm currently writing a sketch to control an LCD menu. A click of the rotary encoder to change menus and rotating the rotary encoder increases/decreases a variable.

after uploading the sketch it'll setup fine but then a bunch of random characters get writtento the LCD constantly. I've double checked my wiring and have uploaded another sketch i made to control the LCD and it works fine.

#include <LiquidCrystal.h>

#define inputCLK A3
#define inputDT A4
#define inputSW A5

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int numberOfScreens = 3;
int previousStateCLK;
int currentStateCLK;
int currentScreen;
String screens[numberOfScreens] = {{"Duration"}, {"UV Light"}, {"Start"}};
int previousButtonState;
int currentButtonState;
int parameters[numberOfScreens];

void setup() {
  pinMode (inputCLK, INPUT);
  pinMode (inputDT, INPUT);
  pinMode (inputSW, INPUT);
  previousButtonState = digitalRead(inputSW);
  currentScreen = 1;
  previousStateCLK = digitalRead(inputCLK);
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print(screens[currentScreen - 1]);
  lcd.setCursor(0, 1);
  lcd.print(parameters[currentScreen - 1]);
  Serial.begin (9600);
}

//start(){
//start motor
//start UV if activated
//delay by duration ammount
//reset parameter values
//got to home screen
//}

void increaseParameter() {
  parameters[currentScreen - 1]++;
}

void decreaseParameter() {
  parameters[currentScreen - 1]--;
}

void printScreen(int screen) {
  lcd.clear();
  lcd.print(screens[currentScreen - 1]);
  lcd.setCursor(0, 1);
  lcd.print(parameters[currentScreen - 1]);

}

void moveRight() {
  currentScreen++;
  printScreen(currentScreen);

}

void loop() {
  currentStateCLK = digitalRead(inputCLK);
  if (currentStateCLK != previousStateCLK) { //If value of CLK has changed, the encoder has rotated
    if (digitalRead(inputDT) != currentStateCLK) { //If DT does not equal CLK, it has been rotated CW
      increaseParameter();
    } else {
      decreaseParameter();
    }
  }
  previousStateCLK = currentStateCLK;
  currentButtonState = digitalRead(inputSW);
  if (currentButtonState != previousButtonState) { //button has been pressed
    moveRight();
    delay (10);
  }
  previousButtonState = currentButtonState;
  //  if(parameter[2] > 0){
  //start();
  //  }
}

I see some use of currentScreen -1 and other places just currentScreen. Probably time to add Serial.print() commands to show on the serial monitor what is actually being used each time.
Paul

I've been having the same problem recently. I haven't figured out why, but the serial output conflicts with the LCD and the latter gets random garbage on it when I output to serial, but only when the serial monitor is active. Resetting the arduino with the serial monitor still open usually helps. Sometimes, a few resets are needed. Another thing to try is to avoid the IDE's monitor and just cat /dev/ttyUSB0 (or whatever your device is) from a terminal. Remember to set it first with

 stty -F /dev/ttyUSB0 raw 9600  # or whatever baud rate you have

If you are not running *NIX, search for a serial monitor for your platform.