LCD Clear

Let me start by saying that I am still very new to the arduino and all of my programming knowledge to this point is in assembly language so if it looks like i could take shortcuts but havent that is why lol. The issue Im having is I want my LCD to count in seconds and to have the position of the cursor be based on the analog value provided by a sensor. The problem Im having is when the number moves the old number remains in the same place. What I need to know is how to clear the LCD screen and then print the new value. Also if you can see in my code a more efficient way to do this please let me know.

#include <LiquidCrystal.h>
int cpos = A5;
int val = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  Serial.begin(9600);
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
 }

void loop() {
  Serial.print(8, BYTE); // Thought this was how to clear it :S
   val = analogRead(cpos);
   Serial.println(val);
   if(val == 0){
      lcd.setCursor(0, 0);
   }
   else if(val >=1 && val <= 32){
     lcd.setCursor(1, 0);
   }
      else if(val >=33 && val <= 64){
      lcd.setCursor(2, 0);
   }
      else if(val >=65 && val <= 96){
      lcd.setCursor(3, 0);
   }
      else if(val >=97 && val <= 128){
      lcd.setCursor(4, 0);
   }
      else if(val >=129 && val <= 160){
      lcd.setCursor(5, 0);
   }
      else if(val >=161 && val <= 192){
       lcd.setCursor(6, 0);
   }
      else if(val >=193 && val <= 224){
      lcd.setCursor(7, 0);
   }
      else if(val >=225 && val <= 256){
      lcd.setCursor(8, 0);
   }   else if(val >=257 && val <= 288){
       lcd.setCursor(9, 0);
   }   else if(val >=289 && val <= 320){
       lcd.setCursor(10, 0);
   }   else if(val >=321 && val <= 352){
      lcd.setCursor(11, 0);
   }
      else if(val >=353 && val <= 384){
      lcd.setCursor(12, 0);
   }   else if(val >=285 && val <= 416){
      lcd.setCursor(13, 0);
   }   else if(val >=417 && val <= 448){
      lcd.setCursor(14, 0);
   }   else if(val >=449 && val <= 480){
      lcd.setCursor(15, 0);
   }
   else if(val >=481 && val <= 512){
     lcd.setCursor(0, 1);
   }
      else if(val >=513 && val <= 544){
     lcd.setCursor(1, 1);
   }
      else if(val >=545 && val <= 576){
     lcd.setCursor(2, 1);
   }   
      else if(val >=577 && val <= 608){
     lcd.setCursor(3, 1);
   }   
      else if(val >=609 && val <= 640){
     lcd.setCursor(4, 1);
   }   
      else if(val >=641 && val <= 672){
     lcd.setCursor(5, 1);
   }   
       else if(val >=673 && val <= 704){
     lcd.setCursor(6, 1);
   }   
       else if(val >=705 && val <= 736){
     lcd.setCursor(7, 1);
   }   
       else if(val >=737 && val <= 768){
     lcd.setCursor(8, 1);
   }   
       else if(val >=769 && val <= 800){
     lcd.setCursor(9, 1);
   }    
        else if(val >=801 && val <= 832){
     lcd.setCursor(10, 1);
   }   
        else if(val >=833 && val <= 864){
     lcd.setCursor(11, 1);
   }   
        else if(val >=865 && val <= 896){
     lcd.setCursor(12, 1);
   }   
        else if(val >=897 && val <= 928){
     lcd.setCursor(13, 1);
   }    
         else if(val >=929 && val <= 960){
     lcd.setCursor(14, 1);
   }   
         else if(val >=961 && val <= 1023){
     lcd.setCursor(15, 1);
   }   
   
  // print the number of seconds since reset:

  lcd.print(millis()/1000);
}

Add this:
lcd.clear();

just before this:
if(val == 0){

  Serial.print(8, BYTE); // Thought this was how to clear it :S

How to clear what? Not the LCD, since it isn't a serial device.

Also if you can see in my code a more efficient way to do this please let me know.

The LCD controller has instructions to move the cursor right or left. Unfortunately these are not implemented in the library so you will have to do things differently.

Why not clear the screen (which also positions the cursor at the beginning of the first line), divide your sensor value by 32 and then print out that number of spaces followed by whatever you want to display? You will have to do some more calculations to deal with moving to the second line, but the idea would be similar.

Don