Time difference of 6 hours?


in code below, function readds3231(); displays different time resulting clock.gettime(year, month, date, dow, hour, minute, second);

why be?

code: [select]
/*
ds3231_test.pde
eric ayars
4/11
test/demo of read routines ds3231 rtc.
turn on serial monitor after loading check if things are
working should.
*/
#include <ds3231.h>
#include <wire.h>
ds3231 clock;
bool h12;
bool pm;
byte aday, ahour, aminute, asecond, abits;
bool ady, a12h, apm;
byte year, month, date, dow, hour, minute, second;
void setup() {
  // start i2c interface
  wire.begin();
  // start serial interface
  serial.begin(9600);
}
void readds3231()
{
  int second,minute,hour,date,month,year,temperature;
  second=clock.getsecond();
  minute=clock.getminute();
  hour=clock.gethour(h12, pm);
  serial.print(hour,dec);
  serial.print(':');
  serial.print(minute,dec);
  serial.print(':');
  serial.print(second,dec);
  serial.print('\n');

}
void loop() {
  readds3231();
  serial.print('\n');
   clock.gettime(year, month, date, dow, hour, minute, second);
   serial.print(hour, dec);
   serial.print(":");
   serial.print(minute, dec);
   serial.print(":");
   serial.println(second, dec);
  delay(1000);

   }

how did set time on clock ?


Arduino Forum > Using Arduino > Programming Questions > Time difference of 6 hours?


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support