Pages: [1]   Go Down
Author Topic: How to calculate intervals and execute an action at the specified time?  (Read 279 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Thanks.
Logged

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you taken a look at the servo library?
http://arduino.cc/en/Reference/ServoWrite
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

East Anglia (UK)
Online Online
Faraday Member
**
Karma: 89
Posts: 3489
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a look at the TimeAlarms library
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: