Time Library added to Playground

mem ,
The Sw i tried using didnt work for me :frowning: ( I sent you PM with the problem)
But I manged to get the uFAT runing and reading from my SD!!!
cool
But write doesn't work .. tried two SDs - they are not write protected .. but I cant write to them (only read the stuff I wrote in the file on windows) :frowning:
any help ? :-[(no errors...)

moriszen, It sounds like the problem relates to the interface to the SD card rather than something to do with the Time Library. I would like to keep this thread focused on issues relating to the Time library.

Perhaps you can start another thread for a discussion on getting your SD card going.

Hey mem,

Just wanted to thank you for writing this library. I was just sitting down to solve this problem and your library pretty much nailed everything I needed.

It works great.

J

Is there an example somewhere of this library running an alarmed event?

Is there an example somewhere of this library running an alarmed event?

There is an example in the TimeAlarms directory in the current download.

See this thread for more details: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1263305457

Ahh, thank you!
I guess I had an older version of Time that didn't have TimeAlarms?

I guess I had an older version of Time that didn't have TimeAlarms?

Yes, the TimeAlarms library was only added recently. Perhaps you can report how you get on with the alarms library in the thread linked above.

Hello !

Is it possibe to run the Time-lib with the NPT Internet Time Sync together with a webserver (e.g. Ben Combees Webduino) ?

I didn't tried it already, but maybe there is somebody who have experiences.

Ollie.

I haven't tried it but would expect you could add the relevant code from the NTP example sketch in the download into Bens webduino library.

Bear in mind that NTP uses the UDP protocol so you would need to add the third party UDP library as documented in the NTP example.

If you want to try this, I suggest you get the NTP example sketch running on its own and then consider how you would want to integrate this into webduino.

I would be interested to follow your progress, perhaps create a new thread to cover this specific topic.

I guess I had an older version of Time that didn't have TimeAlarms?

Yes, the TimeAlarms library was only added recently. Perhaps you can report how you get on with the alarms library in the thread linked above.

It was a joy to use!!
your example was simple & thorough enough for me to understand how to use it.

The only confusion I had was timerRepeat is only in seconds and not
formatted like alarmRepeat but it did not take long to figure out time time * 60 to get minutes.

thank you for such a wonderful & versatile library! :wink:

Glasshopper, good to hear you found the library useful

? timerRepeat is only in seconds and not formatted like alarmRepeat ?

You should be able to set timers just like alarms, did you try something like : Alarm.timerRepeat( 1,30,0, TimerTask); // set timer to repeat every 1 hour and 30 minutes

I have created a Visual Basic application based on the code from Moriszen.

Here is the link: http://www.megaupload.com/?d=1A76PJ5F

Nice to see you got it posted .
Does anyone know if the time library will work in idle - low power mode .
I want to have an application that wakes up once or twice a day an logs the time and date (running on batteries) .
any suggestions ?

The time library relies on the Arduino millis timer which services an interrupt every millisecond. This means it will not work in low power mode.

For an application that needs to wake up once or twice a day you would probably need to use a low power Real Time Clock that generated an interrupt that would wake up the Arduino when it needed to log something. Have a look in the playground to see if anyone has published an RTC application that does something like this.

? timerRepeat is only in seconds and not formatted like alarmRepeat ?
You should be able to set timers just like alarms, did you try something like : Alarm.timerRepeat( 1,30,0, TimerTask); // set timer to repeat every 1 hour and 30 minutes

I see..
Alarm.timerRepeat(1, 0, Repeats);
does not work
but
Alarm.timerRepeat( 0, 1, 0, Repeats);
does.

thank you :smiley:

I could add the overloaded versions if that functionality is what most people expect:

timerRepeat(Period, TimerFunction); // Period in seconds
timerRepeat(Minutes, Seconds, TimerFunction); // Period in Minutes & seconds
timerRepeat(Hours, Minutes, Seconds, TimerFunction); // Period in Hours, Minutes & seconds

then Alarm.timerRepeat(1, 0, Repeats) would do the same thing as Alarm.timerRepeat(0, 1, 0, Repeats);

I think you should make overloaded functions in the library. It's more logical.

For example when I say I'm gonna do something in 5 minutes, I don't say I'm gonna do something in 0 hours and 5 minutes :wink:

Btw I have uploaded the sourcecode of the timesync application:

http://www.megaupload.com/?d=YIEMNV9W

I have being having a play with the 1307rtc and alarm code and it works great apart from one thing.

When i have used other 1307 codes the rtc keeps the time when the power is off ( i have a sparkfun rtc with battery ) with the new code it resets the time and i cant find a way to set the rtc time so when i disconect the power the rtc stores the time.

Any ideas around this because apart from that the codes great and a lot less fuss thatn other codes.

Thanks Adam

..with the new code it resets the time and i cant find a way to set the rtc time so when i disconect the power the rtc stores the time.

Adam, can you clarify the problem you are having.

Is it that you can't set the time on the rtc (using the TimeRTCSet.pde sketch in the download)?

Or that once the time is set it does not display correctly when you disconnect and reconnect power with the RTC board connected to the Arduino board? If the latter, check that the battery in the RTC board is ok.

Looks like a dodgy rtc module.

I have a spare and it works fine, im sure i will be back with some more questions later.

Thanks Adam