How can I set a timer and save the Value?

My project is controlled by high pressure pneumatic cylinders and so I control them with delays. How can I (when delays start and end) set it to time it so I can track where the pistons are to make it move from one position to another without resetting(it needs to be very fast). I also need to reset saved times.

Thanks for the help

Let’s see the sketch you have been working on.

I haven't started a sketch yet (I am at the planning stage) Sorry for the lack of detail I was just asking so I can save this and use it then

Not quite sure what you are actually doing, but, if you want to know how to time events there is a function that’s called millis() that you should learn about.

When your event occurs, you save the current value of millis() into a variable.
At some future time, you compare the current value of millis() with that which was saved earlier.
If the difference between these two times meets with your needs, you respond accordingly.


We need to see your code.
But in the absence of that, you should look at implementing your timing with millis().
This will also allow you to modify the system behaviour on the fly, and possibly offer additional safety options.

Thanks! Sorry I don’t have the code…