Status LED function needed

Here is the function I have come up with. Now I just have to get rid of the delay()'s so the processor is not wasting time and can do other things.

//function to blink LED status code
void blinkLED(int code)
{
  for(int i = 0; i < code; i++)
    {
    	digitalWrite(ledPin, HIGH);
    	delay(200);
    	digitalWrite(ledPin, LOW);
    	delay(200);
    }
    delay (1000);
}

Usage would be like this:

void loop()
{
    blinkLED(4);
}
1 Like