Skip to content

Instantly share code, notes, and snippets.

@t-kashima
Created May 28, 2015 13:19
Show Gist options
  • Save t-kashima/703ff2f351af98d6a099 to your computer and use it in GitHub Desktop.
Save t-kashima/703ff2f351af98d6a099 to your computer and use it in GitHub Desktop.
RTC8564 for Arduino
// http://arms22.blog91.fc2.com/blog-entry-232.html
#include <Wire.h>
#include <RTC8564.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Rtc.begin();
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000);
Rtc.available();
Serial.print(0x2000 + Rtc.years(),HEX);
Serial.print("/");
Serial.print(Rtc.months(),HEX);
Serial.print("/");
Serial.print(Rtc.days(),HEX);
Serial.print(" ");
Serial.print(Rtc.hours(),HEX);
Serial.print(":");
Serial.print(Rtc.minutes(),HEX);
Serial.print(":");
Serial.println(Rtc.seconds(),HEX);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment