example: when my robot i s near an obstacle the proximity sensors give a value and then arduino sent a series of commands to the motors for 8-10 seconds. During this time of 8-10 seconds I need to pause the acquisition from sensors. How can I do?
I posted below the code, when the LDR sensor find the obstacle it starts a three step routine ( motors stop for 2 second, then motors back for 4 seconds, then turn for 4 seconds)
wait() takes hardly any time at all to execute. delay(2000) means sit on your hands and do absolutely nothing (except respond to interrupts) for 2 seconds.
back() takes hardly any time at all to execute. delay(4000) means sit on your hands and do absolutely nothing (except respond to interrupts) for 4 seconds.
turn() takes hardly any time at all to execute. delay(4000) means sit on your hands and do absolutely nothing (except respond to interrupts) for 4 seconds.
The wait(), back(), and turn() functions do not perform any sensor data acquisition. The delay() doesn't either. It does nothing.
So, it seems that you have already addressed the "During this time of 8-10 seconds I need to pause the acquisition from sensors." requirement.
Most people want to do it the other way - delay() but still collect data.