Not sure, but maybe this will help you?
unsigned long elapsed;
bool pinstate;
void InvertState(unsigned long duration)
{
if (millis() - elapsed >= duration)
{
pinstate = !pinstate;
elapsed = millis();
}
print(pinstate ? ("I'm HIGH") : ("I'm LOW"));
}
void loop()
{
InvertState(500);
}
Edit: Thanks Coding Badly and PaulS, I have some difficulties with all those data types..