Go Down

Topic: how to measure time ?  (Read 1 time) previous topic - next topic


dear arduino'ers ;
I want to measure accurate and real Time in my code .
I want to tell servo go to position 90 degree and then after {15 seconds } get back to 0 degree .
I don't want to use delay
I tried millis() but didn't work and RTC() failed because of my board . ( my board is arduino Uno .
please tell me what is the best method for this considering my board as arduino uno or arduino mega 2560 .


Please read and carefully follow the directions in the "How to use this forum" post.

Of course millis() works, but until you post your code, no one can guess what you did wrong.


and RTC() failed because of my board . ( my board is arduino Uno .
I bet it didn't. If the RTC has failed, it is because you don't know what you are doing, but it is quite likely to be OK. You probably don't need an RTC to do what you have in mind but, since you have one, you might as well try to use it properly. RTC modules typically have a 1Hz square wave output pin, so you can count off from any starting point.


then after {15 seconds }
Study, understand and then deeply appreciate the "Blink without delay" example that comes with the Arduino software.

Go Up