Pages: 1 ... 15 16 [17] 18   Go Down
Author Topic: Time and TimeAlarms Libraries – Ask here for help or suggestions  (Read 71552 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The code that I am referring to is the one included as sample with the library.
Great. That narrows it down to one of 8. I'm not into guessing games.

Quote
and the Arduino Time Library is the latest one posted in the Learning/Playground page.
Post a link. There is an Update note on that page that it looks like you didn't follow.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Thanks anyway Paul.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having this problem : closing the Serial Monitor renders timeStatus()=timeNotSet.

I've tried this with HyperTerminal & I get the same behaviour : when I disconnect & then re-connect again, my UNO reports (timeStatus()==timeNotSet) to be TRUE.

Has anyone encountered the same problem? Or am I missing something here?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mem,


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

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.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried your solution, but I still have errors on lines 41 and 58. Here is my line replacement :

Line 48 : PGM_P  monthNames_P[] =
Line 58 : PGM_P dayNames_P[] = { dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7};
Line 59 : const char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThrFriSat";

Of course, this is not the best solution since monthNames and dayNames will be stores in RAM, but ... it works. Any better proposal is welcome !

Hope this help !

Philippe
www.lucidarme.me

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it possible to set the time by GSM shield instead of ethernet shield since both are in a sense connected to ntp servers.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
TimeSerial:24: error: 'time_t' does not name a type
TimeSerial.pde: In function 'void setup()':
TimeSerial:20: error: 'requestSync' was not declared in this scope
TimeSerial:20: error: 'setSyncProvider' was not declared in this scope
TimeSerial.pde: In function 'void loop()':
TimeSerial:29: error: 'timeStatus' was not declared in this scope
TimeSerial:29: error: 'timeNotSet' was not declared in this scope
TimeSerial:31: error: 'timeSet' was not declared in this scope
TimeSerial.pde: In function 'void digitalClockDisplay()':
TimeSerial:39: error: 'hour' was not declared in this scope
TimeSerial:40: error: 'minute' was not declared in this scope
TimeSerial:41: error: 'second' was not declared in this scope
TimeSerial:43: error: 'day' was not declared in this scope
TimeSerial:45: error: 'month' was not declared in this scope
TimeSerial:47: error: 'year' was not declared in this scope
TimeSerial.pde: In function 'void processSyncMessage()':
TimeSerial:65: error: 'time_t' was not declared in this scope
TimeSerial:65: error: expected `;' before 'pctime'
TimeSerial:69: error: 'pctime' was not declared in this scope
TimeSerial:72: error: 'pctime' was not declared in this scope
TimeSerial:72: error: 'setTime' was not declared in this scope
TimeSerial.pde: At global scope:
TimeSerial:77: error: 'time_t' does not name a type
/****************************************************************************/

I am using arduino uno r3
and ide version is 1.0.5

please any one help me

Thank you 


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 anyway
You 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)

Good luck
« Last Edit: August 09, 2014, 02:47:11 pm by Lundin » Logged

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

It would be better to put the Time library in the correct place which is the libraries folder of the sketch folder.

Like this C:\Users\Bob\Documents\Arduino\libraries

The point about having the library folder one level too deep still stands though.
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would be better to put the Time library in the correct place which is the libraries folder of the sketch folder.

Like this C:\Users\Bob\Documents\Arduino\libraries

The point about having the library folder one level too deep still stands though.
oops.. sorry..didn't mean to be misleading  and i didn't know there were a library folder there too.. but it makes perfect sense now that you've mentioned it.

Thanks for pointing it out
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

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.
« Last Edit: August 09, 2014, 06:56:02 pm by FattyPatty01 » Logged

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

Quote
i didn't know there were a library folder there too..
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.
Logged

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

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

Hey guys,

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.
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 ... 15 16 [17] 18   Go Up
Jump to: