I want to create a function which I call out of the void loop().
In this function I want to enable a digital output for 10 seconds.
But when the do is enabled, the void loop() function has to continue during the 10 seconds.
Basically, you switch on and save the value of millis() and then keep checking the value of millis() in loop() and when 10 secs have elapsed it is time to switch off.
boolean AlarmStatus = FALSE;
void loop()
{
int i = 5;
if (i==5)
{
// switch to a alarm function
alarm();
}
}
void alarm()
{
if (AlarmStatus==TRUE)
{
// Turn on a digital output for 10 seconds
}
}
So which elements of BlinkWithNoDelay and Several things at a time do I really need for my minimalistic code?
//Edit:
I want that the LED in void alarm() is just running 10 seconds. After 10 seconds the LED has to get off by itself, without starting the function again.