In my program, while there is a delay, the sensor detects a low water level, it turns the pump on.
How to do that?
If you’re using a delay() in your program, the board won’t do anything else until the delay time has passed.
Instead, you should use timers.
We wrote this tutorial a long time ago, but it should give you a hint: https://randomnerdtutorials.com/why-you-shouldnt-always-use-the-arduino-delay-function/
You can search for the following terms:
- arduino millis()
- arduino timers
- arduibo scheduler