How to calculate intervals and execute an action at the specified time?

Hi guys,

So what I want to do is to calculate specified intervals and then rotate a servo at the specified timing.

For eg, I have 3 inputs to choose from an LCD display: 2,3 and 4 where 2 gives an interval of 12hr, 3 gives 8hr and 4 gives 6hr. So if the user inputs a timing of 12:00 and then chooses the input of 2, the servo would rotate at the specified timing of 12:00. 24:00 and so on.

I would like to know how to write the code of the part where the upon the input if chosen, the interval is determined and this interval is then used to add on to the timing inputted by the user.


Have you taken a look at the servo library?

Yes. I have no issue making the servo rotate..

My issue is more on how to write the code to make the interval and to add it to the input time by the user..

Have a look at the TimeAlarms library