unsigned long startCollecting = millis();
while(millis() - startCollecting < collectionTime)
{
// get some data from the sensor
// do something with the data
}
That will spin, doing useful stuff for however long collectionTime is set to.
unsigned long startCollecting = millis();
while(millis() - startCollecting < collectionTime)
{
// get some data from the sensor
// do something with the data
}
That will spin, doing useful stuff for however long collectionTime is set to.