I have a code which measures distance with a sensor, and depending on the data measured performs a task. But for it to work, it requires that the task is delayed by 2 seconds. But by using delay() the whole code stops, which is not what I want.
How can I only delay the task, and not the whole code?