07-21-2019 03:32 PM
Hi,
I'm trying to manage a peristaltic pump, that can be controlled by servo control signal, with an Arduino Uno board. It should start when the water level sensor reads a value that is smaller than a reference one. This operation must continue until stop button is pressed. The problem is that it works well for 3 times (open servo channel, compare (only if it's needed), close servo channel) and then it continues to go without stopping, even if i press the stop button.
Do you have any idea to solve it?
Thanks.
07-21-2019 09:27 PM
You're probably getting stuck in the innermost while loop which is going to run as long as the analog read is less than the reference level.
You should only need one while loop with one case structure inside of it. And perhaps a shift register that should keep track of whether the pump should be on or off.
07-22-2019 02:06 AM
Hi,
thanks for your answer, but it is not blocking in the innermost loop, since looking with the highlight mode (bulb on) the signal goes out form the loop (when the condition is satisfied) and it interacts with the "servo close" block but after 3/4 times it stops to execute in the right way and it doesn't close the channel.