Programming problem

Dear cypherrage
I have a question to ask

In the process of running the program, the work can not be performed simultaneously two

(1)I need to find the angle after the delay in the implementation of the next action.

The problem is LED lit delay of 10 seconds while (execute one bright one dark) and (discrimination angle) program, without the right to find the angle would have been performed to identify the correct angle one second delay after executing the following program.
Attach pictures & code

#include <Wire.h>
#include <HMC5883L.h>
HMC5883L compass;
void setup()
{
Serial.begin(9600);
Wire.begin();
compass = HMC5883L();
compass.SetScale(1.3);
compass.SetMeasurementMode(Measurement_Continuous);
pinMode(8, OUTPUT);
digitalWrite(8, LOW);
delay(10000);
digitalWrite(8, HIGH);
}
void loop()
{
MagnetometerRaw raw = compass.ReadRawAxis();
MagnetometerScaled scaled = compass.ReadScaledAxis();
float xHeading = atan2(scaled.YAxis, scaled.ZAxis);

if(xHeading < 0) yHeading += 2PI;
if(xHeading > 2
PI) yHeading -= 2*PI;

int xDegrees = xHeading * 180/M_PI;

Serial.print(xDegrees);
Serial.print(", ");

if ((xDegrees >= 80) && (xDegrees <= 90)) {
digitalWrite(8, LOW);
} else {
digitalWrite(8, HIGH);
}
}

???????

When both lights are on, you want that to happen for 5 seconds and then what? After 5 seconds, does LED turn OFF, or is that only if angle is between 80 and 90 degrees? What is the condition under which the loop resets?