bool isReady = false;
void loop()
{
if(isReady == false)
{
//No data just wait
}
else
{
myMethod();
}
}
unsigned long previousMillis = 0;
void myMethod()
{
int counter = 0;
for(int i = 0; i < 1024; i ++)
{
//other operations
if(counter == 64)
{
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis += interval;
//Do Work HERE
counter = 0;
}
}
else{counter ++};
}
}