Arduino Pause and resume features?

Hi guys, I need help on my project where I need to control a 12V pump by using Arduino.

  1. After enough coins are inserted into the coin slot, Arduino will generate an output signal to switch on the relay in order to activate the pump. (Coin slot is another component connected to the Arduino)
  2. The pump can only be activated for 10 mins, after 10 mins, it must stop. However, the process can be repeated again if coins are inserted again.
  3. During the 10 mins, i need a pause feature to stop the pump temporarily(probably using a pushbutton to initiate the pause process), of course, when the pump is paused, the time must stop to run also. If the pushbutton is pressed again, the pump will be activated again and the time will continue to run.
  4. The loop in step 3 must be infinite.

Any idea about the coding and functions needed? Thx for the help as I am a newbie on this.

What Resolution do you Need? Does an extra half second here or there matter?

I assume that the pump can be stopped at ANY time, not for example within several seconds of pressing the button.

Go through the tutorials to learn the basics

DON'T use the Delay Function -

See this post at the top of the forum - Doing several things at once - might take a couple of tries to get through it the first time

https://forum.arduino.cc/index.php?topic=223286.0

Good luck

JaBa:
What Resolution do you Need? Does an extra half second here or there matter?

I assume that the pump can be stopped at ANY time, not for example within several seconds of pressing the button.

Ya, the pump can be stopped at any time.

Pretty straightforward build.

Get your coin acceptor to work: make an Arduino count the coins and print it on the Serial console or so. Fair chance you can treat it as a button, depends on your actual coin acceptor.

Get your pump to work: get it to run for some time, stop for some time, etc. Like blink, but then with a pump instead of an LED. How to connect this pump, depends on the pump. You'll need external hardware/power supply for this. Go for Blink Without Delay as a delay call will prevent you from reading the button to stop the pump, or any new coins being inserted.

Connect a button, learn to read it.

Put the three together. Done. All such code you can find in the examples of the IDE.