Pages: 1 2 [3] 4 5 ... 10   Go Down
Author Topic: Time Library added to Playground  (Read 34319 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
… 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-grin
Logged

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

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);
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino FTW!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Btw I have uploaded the sourcecode of the timesync application:

http://www.megaupload.com/?d=YIEMNV9W
« Last Edit: January 21, 2010, 09:39:03 am by Peeter123 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Quote
..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.
« Last Edit: January 30, 2010, 08:02:22 am by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys ,
I am trying to complete my logger project where my Arduino runs on batteries in low power (<1uA) and wakes up every specified time , reads the temperature off a thermal resistor , logs the data in an external SPI SD Flash along with date and time and goes back to sleep .
The problem is that the init of the SD starts logging from the beginning of the file and doesn't append an the sleep libraries don't seems to work so well with it .
Does anyone know of any similar project that was done along this area .
I couldn't find anything in the playground yet it seems very likely other people have done similar projects . :smiley
Logged

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

moriszen, as I posted in an earlier reply to a question on your project, I would like to keep this thread focused on issues relating to the Time library.

You are more likely to attract relavant replies if you start a new thread with a title relevant to your project.
« Last Edit: January 30, 2010, 05:25:59 pm by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry (again)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

I am trying to use the Time Library on an RFID door project. It's running on an Arduino MEGA. I have a GPS hooked up to it, but when I tried to run it using the GPS code it completely locked up and would not allow any input. Instead, I am manually getting the date and time using gps.crack_datetime() and inputting it into setTime(), then using adjustTime(-18000) for the eastern time zone. It will only run the GPS dump if it has been around an hour or more since the last time. At first turn on, it gets the correct time and displays it on the LCD, and updates the LCD every minute perfectly. But after the door is opened, it waits in an endless loop for the the door to close before re-locking. The time is then way off. The code for the loop is posted below.

Thanks for your help,
Eddie Schnell

Code:
if(digitalRead(intopen) == LOW) return;                              // manual lock
  while(digitalRead(trigger) == HIGH) {
    delay(5);                                                          // take a breath
    if(digitalRead(intopen) == LOW) return;                            // manual lock
    Serial.println("Close the Door");                                  // debug
  }
  Serial.println("First Test Door Closed");                            // debug
  delay(50);
  if(digitalRead(intopen) == LOW) return;                              // manual
  delay(50);
  if(digitalRead(intopen) == LOW) return;                              // manual
  delay(50);
  if(digitalRead(intopen) == LOW) return;                              // manual
  if(digitalRead(trigger) == HIGH) {
    Serial.println("Failed Second Test");                              // debug
    while(digitalRead(trigger) == HIGH) {
      delay(5);                                                        // take a breath
      if(digitalRead(intopen) == LOW) return;                          // manual
      Serial.println("Close the Door Again");                          // debug
    }
  }
Logged

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

Lets see if we can find out why you had problems running the example GPS code, perhaps that may be related to the problem you are having in your current sketch.

Was the example code that locked up modified, and if so, can you post the code you ran.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, I went back to the original GPS code and put it into my code. It does not lock up everything, but it's stuck in 1970. It does seem to be counting in the loops though.

The code is too long to post, it is viewable at http://www.schnellnetworks.com/code.html

Thanks,
Eddie
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Had a breakthrough. When I pressed some of the buttons on the door, it magically got the correct time on the screen. I changed the startup code to wait for serial data to be available by using the feedgps function, then called the gps.encode line for the Time library to read, and now it seems to be getting the correct time at startup.

Code:
Serial.println("Waiting for GPS Time...");                          // debug
  setSyncProvider(gpsTimeSync);
  while(feedgps() != true) {                                          // if feedgps is false
    delay(50);                                                        // take a breath
  }
  gps.encode(Serial3.read()); // process gps messages

Thanks,
Eddie Schnell
Logged

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

Eddie, good to hear you have it working, it looks like an interesting project. Perhaps you could post some more details in the exhibition forum when you are ready.

For the benefit of others  that may want to test using the GPS example code in the download, did that work as expected with your GPS after you changed the serial port for the Mega, but before you added any logic for your application?
Logged

Birmingham, AL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 91
Arduino, disobey me.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In reply #4 Veronica pointed out:
Code:
#include <time.h>

in Time.cpp should have a capital T.

This is the case ( smiley-wink) in the DS1307RTC.h file also.

It took me way too long to figure out this was the problem.

Otherwise, great library.  I've been using the old one since last June, and it's nice to have RTC support integrated.
Also I was _really_ glad to see the default TIME_HEADER changed to 'T' instead of 255.

-transfinite
Logged

Pages: 1 2 [3] 4 5 ... 10   Go Up
Jump to: