How about code optimization

excuse me, please guide

The purpose of the code is to control the air valve with Arduino
Supply air pressure to control dispensing after reaching the up, down and down of the mechanical mechanism
After finishing dispensing, resume the mechanism to rise

Currently working normally
But I used a timing relay for the dispensing time
(Amazon.com)

The disadvantage is that the mechanism cannot be restored immediately after the dispensing is completed
I would like to ask you how seniors can optimize the code
Make machinery work smoother?

Please share your experience and guidance
thank you very much

======================================
digitalWrite(11, HIGH); //Start glue out
delay(5000); //Glue time (can change the countdown Relay to control the glue time) 5000ms need to synchronize timing relay (it needs to be greater than the relay time about 1-2 seconds)
digitalWrite(11, LOW); //Stop the glue
delay(300); //Stop the glue (can change the countdown Relay to control the glue time)

sketch_dec20a.ino (1.51 KB)

Post code, in code tags, not pictures of code.

digitalWrite(11, HIGH);   //Start glue out
...
digitalWrite(11, LOW); //Stop the glue

If you gave the pin a sensible name, you wouldn't need the comments, and your code would be easier to maintain.
Names don't cost anything.

If the Arduino is controlling the timing, why do you also need that special relay board?

TheMemberFormerlyKnownAsAWOL:
Post code, in code tags, not pictures of code.

digitalWrite(11, HIGH);   //Start glue out

...
digitalWrite(11, LOW); //Stop the glue



If you gave the pin a sensible name, you wouldn't need the comments, and your code would be easier to maintain.
Names don't cost anything.

Understand thanks for your guidance

wildbill:
If the Arduino is controlling the timing, why do you also need that special relay board?

Hello Widbill
Because I hope to set and modify the delay time directly on the relay,
This way you don’t have to modify the code all the time and upload it to the Arduino uno board again.
Thank you for your reply