#include <Wire.h>

#define ds3231_adr 0x68

void setTime()
{
   Wire.beginTransmission(ds3231_adr); 
   Wire.write(0x00);

   Wire.write(0x50);//sek
   Wire.write(0x59);//min
   Wire.write(0x12);//sat
   Wire.endTransmission();   
}

void setup()
{
  Wire.begin();
  Serial.begin(9600);

  
}


void checkSerial()
{
  
}



void loop()
{
  checkSerial();
  
  
  Wire.beginTransmission(ds3231_adr); 
  Wire.write(0x00);
  byte I2Cerror = Wire.endTransmission();      
  if(I2Cerror)
  {
      Serial.print("I2C error :");     
      Serial.println(I2Cerror);
      delay(1000);
      return;
  }

  Wire.requestFrom(ds3231_adr,3);
  byte seconds = Wire.read();
  byte minutes = Wire.read();
  byte hours = Wire.read();
  
  Serial.print(hours,HEX);Serial.print(":");
  Serial.print(minutes,HEX);Serial.print(":");
  Serial.print(seconds,HEX);
  Serial.print("\n");
  delay(250);
}
GND5VSDASCLSQWRTCDS1307+