if within a delay


Unfortunatly I don't know enough coding to even formulate the question properly and therefor I can't really search for an answer, so ask here seems to be what I have to do.

I have a loop with a lot of delays and I need to have the sensors to be checked all the time, even during the delays. Now the sensors is checked only once per loop and the complete loop takes a while with all the delays. How do I code to make the Arduino to check the sensors several times every second to use the result in an "if". For example if I have a code for running a motor during a delay of 10 min but I need the motor to be switched of if a sensor is trigged.

I do apologize since I understand that it probably exists a really basic easy answer to this.

You need to look at the blink without delay example in the IDE to see how to eliminate delays from your code, or see Robin2's tutorial on how to do several things at the same time.

Thank you! I will try this.

Delay makes your processor go brain dead stupid for the duration it is waiting. Do not ever use delay any time you want to multi task.