And here is the sketch that the flash rate can be changed for different function calls.
//Define pin names.
#define pin_Heartbeat_LED 13
//Setup globle variables.
byte HeartbeatLED = LOW;
int Interval = 500;
long HeartbeatOldMillis = 0;
void setup()
{
//Setup pin states.
pinMode(pin_Heartbeat_LED, OUTPUT);
}
void loop()
{
Heartbeat(Interval);
}
//Heartbeat to show program is alive.
void Heartbeat(int Interval)
{
long HeartbeatNewMillis = millis();
if(HeartbeatNewMillis - HeartbeatOldMillis > Interval)
{
HeartbeatOldMillis = HeartbeatNewMillis;
if(HeartbeatLED == LOW)
{
HeartbeatLED = HIGH;
}
else
{
HeartbeatLED = LOW;
}
digitalWrite(pin_Heartbeat_LED, HeartbeatLED);
}
}
just change the interval time at the top of the scetch. Hope it useful.