There is an Update note on that page that it looks like you didn't follow.

Silly/Lazy me. I actually started reading the last time I visited those links but it throws me off instead educating me. I got more confused. I may just have to read again and experiment with my minimal understanding.

Otherwise, my easier solution is just to rely on the delay function of the Arduino and start the sequence at a specific time of day where my program coincides with my desired timing. I'll just pray that no black-outs during my absence so the timing will not change.

I tried some thing like this.. but on my lcd display i recieve only the current time and a "on" when the switch is not pressed it shows current time then after 1s delay a "on". when i press the button switch for some times the current time stays on the display untill i release the switch. it doesnt changes the display to "on" when the switch is not pressed. when i release the switch old routine comes back.

i couldnt get the duration.

You are close but there are some errors in your code. You are using buttonState instead of buttonPin in your digitalRead function. Also, you have declared two event variables, one at the beginning of loop and the other in the code that handles the state where the digitalRead is high. Move the time_t event declaration to the top of the sketch where your other global variables are declared and remove time_t from the line where you set event= now() . You can read the arduino reference pages on declaring variables and variable scope for more on this issue.

The issues you are having are not related to the time libraries so I suggest that start a new thread to discuss your project and post a link here so I and others can follow.

samly_dixon

You are close but there are some errors in your code. You are using buttonState instead of buttonPin in your digitalRead function. Also, you have declared two event variables, one at the beginning of loop and the other in the code that handles the state where the digitalRead is high. Move the time_t event declaration to the top of the sketch where your other global variables are declared and remove time_t from the line where you set event= now() . You can read the arduino reference pages on declaring variables and variable scope for more on this issue.

Thank you so to for pointing out my silly coding errors. Its now giving the duration in seconds.

Quote

The issues you are having are not related to the time libraries so I suggest that start a new thread to discuss your project and post a link here so I and others can follow.

I will open a new thread and share the link here. Thank you again for your help.

As soon as I try to verify an unmodified TimeNTP sketch I get the followiong error messages

Quote

In file included from /home/shrek/sketchbook/libraries/Time/DateStrings.cpp:11:0:/home/shrek/sketchbook/libraries/Time/DateStrings.cpp:41:22: error: variable 'monthNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PGM_P monthNames_P[] PROGMEM = ^/home/shrek/sketchbook/libraries/Time/DateStrings.cpp:58:20: error: variable 'dayNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PGM_P dayNames_P[] PROGMEM = { dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7}; ^/home/shrek/sketchbook/libraries/Time/DateStrings.cpp:59:24: error: variable 'dayShortNames_P' must be const in order to be put into read-only section by means of '__attribute__((progmem))' char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";

What should I do to get the time NTP request function or feature to work. Also if it can be modified to use as external source the time message provided to all gsm enabled phones by the network via the GSM shield I would appreciate it.

I am a beginner in arduino .I just add this time library and try to test an example .But i found those errors/**************************************************************************/ TimeSerial.pde:12:20: warning: Time.h: No such file or directoryTimeSerial:24: error: 'time_t' does not name a typeTimeSerial.pde: In function 'void setup()':TimeSerial:20: error: 'requestSync' was not declared in this scopeTimeSerial:20: error: 'setSyncProvider' was not declared in this scopeTimeSerial.pde: In function 'void loop()':TimeSerial:29: error: 'timeStatus' was not declared in this scopeTimeSerial:29: error: 'timeNotSet' was not declared in this scopeTimeSerial:31: error: 'timeSet' was not declared in this scopeTimeSerial.pde: In function 'void digitalClockDisplay()':TimeSerial:39: error: 'hour' was not declared in this scopeTimeSerial:40: error: 'minute' was not declared in this scopeTimeSerial:41: error: 'second' was not declared in this scopeTimeSerial:43: error: 'day' was not declared in this scopeTimeSerial:45: error: 'month' was not declared in this scopeTimeSerial:47: error: 'year' was not declared in this scopeTimeSerial.pde: In function 'void processSyncMessage()':TimeSerial:65: error: 'time_t' was not declared in this scopeTimeSerial:65: error: expected `;' before 'pctime'TimeSerial:69: error: 'pctime' was not declared in this scopeTimeSerial:72: error: 'pctime' was not declared in this scopeTimeSerial:72: error: 'setTime' was not declared in this scopeTimeSerial.pde: At global scope:TimeSerial:77: error: 'time_t' does not name a type/****************************************************************************/

I am a beginner in arduino .I just add this time library and try to test an example .But i found those errors/**************************************************************************/ TimeSerial.pde:12:20: warning: Time.h: No such file or directory

A bit old post, but anywayYou need to download and put the Time library where you installed the IDE (like: C:/program(x86)/Arduino/Libraries/Time The sketch can't find this library when you try to compile and send it to the UNO .If you have downloaded the Time library, be sure it's not put inside a second folder by the same name ( i.e Time/Time)

FattyPatty01

I happen to have a question about TimeAlarms. Can you use the TimeAlarm library to activate a servo motor at a certain time? And also, can you sync the RTC DS1307 to the TimeAlarm? If you can, how do you? Any help would be appreciated. Thanks.

The libraries folder in the sketch folder is designed to hold user contributed libraries that are available to all versions of the IDE of which there may be several installed as it is upgraded. The libraries folder under the main Arduino folder is designed to hold libraries supplied with the IDE of which there could potentially be more/different versions specific to an IDE version.

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

I happen to have a question about TimeAlarms. Can you use the TimeAlarm library to activate a servo motor at a certain time? And also, can you sync the RTC DS1307 to the TimeAlarm? If you can, how do you? Any help would be appreciated. Thanks.

The answer to both of these is yes. Look at the example with the TimeAlarms library to see how to carry out actions at specific times or to repeat them at specific intervals. The TimeAlarms library makes use of the Time library which makes it possible to synch the alarms with an RTC. Simply set the time using the RTC and it becomes available to TimeAlarms.

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