DS1037 10 minutes late
hello !
i'm posting 2 reasons i2c ds1307 module :
- take ds1307 example, transfered nano, , have problem it, hour displayed 10 minutes late... here's sketch :
and can see, "rtc.adjust(datetime(f(__date__), f(__time__)));" uncommented...
- finally, default analog pins make rtc works, scl : a5; sda : a4. pins in use (in case) other module, there way change pins ?
thank !
i'm posting 2 reasons i2c ds1307 module :
- take ds1307 example, transfered nano, , have problem it, hour displayed 10 minutes late... here's sketch :
code: [select]
// date , time functions using ds1307 rtc connected via i2c , wire lib
#include <wire.h>
#include "rtclib.h"
rtc_ds1307 rtc;
char daysoftheweek[7][12] = {"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"};
void setup () {
while (!serial); // leonardo/micro/zero
serial.begin(57600);
if (! rtc.begin()) {
serial.println("couldn't find rtc");
while (1);
}
if (! rtc.isrunning()) {
serial.println("rtc not running!");
// following line sets rtc date & time sketch compiled
rtc.adjust(datetime(f(__date__), f(__time__)));
// line sets rtc explicit date & time, example set
// january 21, 2014 @ 3am call:
// rtc.adjust(datetime(2014, 1, 21, 3, 0, 0));
}
}
void loop () {
datetime = rtc.now();
serial.print(now.year(), dec);
serial.print('/');
serial.print(now.month(), dec);
serial.print('/');
serial.print(now.day(), dec);
serial.print(" (");
serial.print(daysoftheweek[now.dayoftheweek()]);
serial.print(") ");
serial.print(now.hour(), dec);
serial.print(':');
serial.print(now.minute(), dec);
serial.print(':');
serial.print(now.second(), dec);
serial.println();
delay(3000);
}
and can see, "rtc.adjust(datetime(f(__date__), f(__time__)));" uncommented...
- finally, default analog pins make rtc works, scl : a5; sda : a4. pins in use (in case) other module, there way change pins ?
thank !
you not explaining problem well, might because aren't setting time properly.
i use http://bildr.org/2011/03/ds1307-arduino/
scl , sda i2c bus. several devices can share pins
i use http://bildr.org/2011/03/ds1307-arduino/
scl , sda i2c bus. several devices can share pins
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > DS1037 10 minutes late
arduino
Comments
Post a Comment