How to measure the time my hand stays in front of an ultrasonic sensor?

Hi monsignore,
welcome to the arduino-forum.

There is a function that counts milliseconds. Up until it reaches 4.294.967.295 which is 49,7 days. Pretty long what ?

Long is a good keyword here. To work with this function you need a variable of type
unsigned long.

This function counting up milliseconds is called millis()
This is what you need here. And measuring time - your 10 seconds - is done with this function. Ten seconds are equal to 10000 milliseconds

here is a tutorial about timing based on function millis()

best regards Stefan

2 Likes