I need to query sensors while running an algorithm simultaneously. The sensor querying updates an array that is referenced by the algorithm. That is, I need the algorithm to access values in the array and know that they are the most recent values observed. I have a function for querying the sensors attached to an interrupt, which I believe means the sensors will be queried at a consistent time step.
If my Arduino is in the middle of a very long while loop, and the interrupt is called, will both the while loop and the function attached to the interrupt be carried out simultaneously? If not, what will happen? Which takes priority?
On a related note, in the same situation as above, if both are run simultaneously, and I have delay(x) in my sensor query, will that pause the whole system as it would were delay(x) used in the main loop?