     lcd.write((uint8_t)2);
     lcd.setCursor(19, 0);
     lcd.write((uint8_t)2);
-    
+
     inputString = "";
     stringComplete = false;
+    previousUpdate = millis();
+  } else {
+    // Check if we should turn off the backlight
+    if (millis() > previousUpdate + SCREEN_OFF_DELAY && screenOn) {
+      // Turn off the backlight
+      screenOn = false;
+      analogWrite(PIN_BACKLIGHT, LOW);
+    }
   }
 }

#define PIN_D6 3
#define PIN_D7 2

LiquidCrystal lcd(PIN_RW, PIN_EN, PIN_D4, PIN_D5, PIN_D6, PIN_D7);

String inputString = "";        // String for buffering the message
boolean stringComplete = false; // Indicates if the string is complete
int curFanChar = 0;             // Current character of fan animation

byte fanChar1[8] = {
  0b00000,

  // Setup contrast and backlight
  analogWrite(PIN_CONTRAST, CONTRAST);
  analogWrite(PIN_BACKLIGHT, BACKLIGHT);

  // Setup LCD
  lcd.begin(20, 4);
  printInitialLCDStuff();

  // Setup serial
  Serial.begin(9600);
  inputString.reserve(200);
