Medical scrub sink water control system

hello everyone
I'm new here and noob in programming
can somebody help me to write a simple code on Arduino nano?
I'm planning to make a medical scrub sink water control system using ir sensor module, Arduino nano, relay and solenoid.
how to write such a code which runs such a way that only ON solenoid when something detect ir sensor and it turned on for 30 sec, if it detect signal when it's ON condition then it's should be turn OFF?
thanks in advance :slightly_smiling_face:

4 posts were merged into an existing topic: Medical scrub sink water control system coding