Problem with turning LCD off

UKHeliBob:
So, some progress.

Now, which pin is this reading ?

  if ((digitalRead(powervalp06) == HIGH))

It is supposed to be reading pin 6, but now that you mention it I don't know if that is specified anywhere. Is there a way to differentiate between which pin you're assigning it to and what value (high or low) it is set at?

EDIT: No, I'm wrong. It should be reading pin 6 from this line:

  powervalp06 = digitalRead(power);