First Steps

AWOL:

 else digitalWrite(ledred, LOW); digitalWrite(ledgreen, LOW);

Are you missing some braces here?
The 'else' only makes the red LED conditional, but the green will always be turned off.

how can i change this?