Status LED function needed

This is my way and works great.

//Define pin names.
#define pin_Heartbeat_LED     13

//Setup globle variables.
byte HeartbeatLED = LOW;
long HeartbeatOldMillis = 0;

void setup()
{
//Setup pin states.
pinMode(pin_Heartbeat_LED, OUTPUT);
}

void loop()
{
  Heartbeat();
}

//Heartbeat to show program is alive.
void Heartbeat()
{
  long HeartbeatNewMillis = millis();
  if(HeartbeatNewMillis - HeartbeatOldMillis > 500)
  {
    HeartbeatOldMillis = HeartbeatNewMillis;
    if(HeartbeatLED == LOW)
    {
      HeartbeatLED = HIGH;
    }
    else
    {
      HeartbeatLED = LOW;
    }
    digitalWrite(pin_Heartbeat_LED, HeartbeatLED);
  }
}

If you want different flash rates then juat creat anouther globle variable for the high/low time and send the time to the fuction to replace to 500. Simple and will not lock up your sketch.