EDIT: No, I'm wrong. It should be reading pin 6 from this line:
That assigns a value of 0 (LOW) or 1 (HIGH) to powervalp06;
So, when you use:
if ((digitalRead(powervalp06) == HIGH))
Which pin did you read from? The answer, of course, is either pin 0 or pin 1. Is that the pin you want to be reading from? I don't think it is.