I have been trying to use millis() instead of delays for some time and I have a few questions.
The first question is there any significant difference between the 2 functions below. And the second question is how can I use millis() either globally or across multiple functions?
void function1()
{
unsigned long currentTime = millis();
if (currentTime - previousTime > interval)
{
previousTime = currentTime;
//do stuffy here
}
}
void function2()
{
if (millis() - previousTime > interval)
{
previousTime = millis();
//do stuff here
}
}