Arduino Timer

I’m Pratik…
Recently I started shadowing under the arduino and programming. Since my branch and this kind of stuff is nothing to do with it. Even though I liked its simplicity and started working for it.
Now, The problem where I stucked was looking me little bit complicated. Using Ultrasonic displacement module and variation in height I would liked to tern ON/OFF the led light and it worked perfectly for me.
But now I want to Tern ON that LED after some delay and that delay is calculated using kind of equation. I want to get data from sensor in regular intervals like 10ms and tern ON LED after some time delay. And this must goes on.
I hop you got this and hopping for solution as early as possible. Thank you in advance.

Thank you

Arduino has functions that return unsigned long time values you can save and use to determine elapsed time.

There is millis() that tells milliseconds since start and micros() that tell microseconds to the nearest 4.

Here is a common sense tutorial on using time to make many things run together on Arduino:

It teaches the heart of automation code. His site is full of good and detailed lessons for microcontrollers.

I don’t know your programming skill level. It is better to learn the basics before trying this, that is more important first.