 int i = 0;
 void loop() {
 
-  if (Serial.available() >= 2){ 
+  int delta = millis() - lastSavedTime;
+
+  if(delta<0){
+    //overflow of millis();
+    lastSavedTime = millis();
+  }
+
+  if(!turnedOff&&delta>millisToTurnOff){
+    turnBacklightOff();
+  }
+
+  if (Serial.available() >= 2){
+
+    lastSavedTime = millis();
     
-    /*lcd.setCursor(0,0); //FOR TESTING
-     while(Serial.available()){
-     lcd.print(Serial.read());
-     lcd.print(" ");
-     }*/
-     
+    if(turnedOff){
+      turnBacklightOn();
+    }
+
     // read the incoming byte:
     char input = char(Serial.read());
 

/*
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

};

void setup() {

  pinMode(lcdPin, OUTPUT);      // sets the digital pin as output
  turnBacklightOn();

  lastSavedTime = millis();

  Serial.begin(4800);
  Serial.println("Hi, I am alive!");

  // set up the LCD's number of columns and rows: 
