Scrolling input text

I think I've got it to work! :slight_smile:

What would be the best way to tighten this code up?

#include <SimpleTimer.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(8,9,10,11,12,13);
SimpleTimer timer;
static char input[50];
char  printdata[50];
int timer_prt_Id;
void get_serial_data()
{

  static unsigned int pos = 0;
  Serial.println("Get_serial_data");
  while (Serial.available()>0)
  {
    Serial.println("Data Available!");
    char inByte = Serial.read();

    switch(inByte)
    {
    case '\n':
      input[pos] = 0;
      Serial.println("gotdata");
      timer.disable(timer_prt_Id);
      lcd.clear();
      process_data(input);
      pos=0;
      break;
    case '\r':
      Serial.print("Enter");
      break;
    default:
      if (pos<50-1)
      {
        input[pos++] = inByte;
        Serial.println(inByte);
      }
      break;
    }

  }
}

void process_data(char * processdata)
{
  Serial.println("Processdata");
  if(strcmp(processdata,"clear") == 0)
  {
    lcd.clear();
    timer.disable(timer_prt_Id);
  }
  timer.enable(timer_prt_Id); 
  strcpy(printdata,input);


}

void print_data()
{
  unsigned int l = strlen(printdata);
  unsigned int x,y;

  lcd.setCursor(0,0);
  if (l <=16)
  {
    delay(100);
    lcd.print(printdata);
    return;
  }
  for ( x=0; x<l-16;x++)
  {
    for(y=x;y<x+16;y++)
    {
      lcd.print(printdata[y]);
    }
    if ( x == 0) delay(300);
    delay(200);
    lcd.home();
  }

}
void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  timer.setInterval(1000, get_serial_data);
  timer_prt_Id = timer.setInterval(100, print_data);

}

void loop()
{
  timer.run();

}

My ultimate aim is to interface it with my system to notify me of particular events.