<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_RTC_DS3231_Unix_Time</id>
	<title>Arduino: RTC DS3231 Unix Time - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_RTC_DS3231_Unix_Time"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_RTC_DS3231_Unix_Time&amp;action=history"/>
	<updated>2026-04-20T15:26:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_RTC_DS3231_Unix_Time&amp;diff=45833&amp;oldid=prev</id>
		<title>Onnowpurbo: New page: ==Code==    // DS3231_UnixTime (C)2014 Henning Karlsen  // web: http://electronics.henningkarlsen.com/  //  // A quick demo of how to use my DS3231-library to   // convert date and time to...</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_RTC_DS3231_Unix_Time&amp;diff=45833&amp;oldid=prev"/>
		<updated>2016-03-03T09:19:16Z</updated>

		<summary type="html">&lt;p&gt;New page: ==Code==    // DS3231_UnixTime (C)2014 Henning Karlsen  // web: http://electronics.henningkarlsen.com/  //  // A quick demo of how to use my DS3231-library to   // convert date and time to...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Code==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 // DS3231_UnixTime (C)2014 Henning Karlsen&lt;br /&gt;
 // web: http://electronics.henningkarlsen.com/&lt;br /&gt;
 //&lt;br /&gt;
 // A quick demo of how to use my DS3231-library to &lt;br /&gt;
 // convert date and time to UnixTime&lt;br /&gt;
 //&lt;br /&gt;
 // To use the hardware I2C (TWI) interface of the Arduino you must connect&lt;br /&gt;
 // the pins as follows:&lt;br /&gt;
 //&lt;br /&gt;
 // Arduino Uno/2009:&lt;br /&gt;
 // ----------------------&lt;br /&gt;
 // DS3231:  SDA pin   -&amp;gt; Arduino Analog 4 or the dedicated SDA pin&lt;br /&gt;
 //          SCL pin   -&amp;gt; Arduino Analog 5 or the dedicated SCL pin&lt;br /&gt;
 //&lt;br /&gt;
 // Arduino Leonardo:&lt;br /&gt;
 // ----------------------&lt;br /&gt;
 // DS3231:  SDA pin   -&amp;gt; Arduino Digital 2 or the dedicated SDA pin&lt;br /&gt;
 //          SCL pin   -&amp;gt; Arduino Digital 3 or the dedicated SCL pin&lt;br /&gt;
 //&lt;br /&gt;
 // Arduino Mega:&lt;br /&gt;
 // ----------------------&lt;br /&gt;
 // DS3231:  SDA pin   -&amp;gt; Arduino Digital 20 (SDA) or the dedicated SDA pin&lt;br /&gt;
 //          SCL pin   -&amp;gt; Arduino Digital 21 (SCL) or the dedicated SCL pin&lt;br /&gt;
 //&lt;br /&gt;
 // Arduino Due:&lt;br /&gt;
 // ----------------------&lt;br /&gt;
 // DS3231:  SDA pin   -&amp;gt; Arduino Digital 20 (SDA) or the dedicated SDA1 (Digital 70) pin&lt;br /&gt;
 //          SCL pin   -&amp;gt; Arduino Digital 21 (SCL) or the dedicated SCL1 (Digital 71) pin&lt;br /&gt;
 //&lt;br /&gt;
 // The internal pull-up resistors will be activated when using the &lt;br /&gt;
 // hardware I2C interfaces.&lt;br /&gt;
 //&lt;br /&gt;
 // You can connect the DS3231 to any available pin but if you use any&lt;br /&gt;
 // other than what is described above the library will fall back to&lt;br /&gt;
 // a software-based, TWI-like protocol which will require exclusive access &lt;br /&gt;
 // to the pins used, and you will also have to use appropriate, external&lt;br /&gt;
 // pull-up resistors on the data and clock signals.&lt;br /&gt;
 // &lt;br /&gt;
 &lt;br /&gt;
 #include &amp;lt;DS3231.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 // Init the DS3231 using the hardware interface&lt;br /&gt;
 DS3231  rtc(SDA, SCL);&lt;br /&gt;
 &lt;br /&gt;
 Time t;&lt;br /&gt;
 &lt;br /&gt;
 void setup()&lt;br /&gt;
 {&lt;br /&gt;
   // Setup Serial connection&lt;br /&gt;
   Serial.begin(9600);&lt;br /&gt;
   // Uncomment the next line if you are using an Arduino Leonardo&lt;br /&gt;
   //while (!Serial) {} &lt;br /&gt;
 &lt;br /&gt;
   // Initialize the rtc object&lt;br /&gt;
   rtc.begin();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop()&lt;br /&gt;
 {&lt;br /&gt;
   // Send Current time&lt;br /&gt;
   Serial.print(&amp;quot;Current Time.............................: &amp;quot;);&lt;br /&gt;
   Serial.print(rtc.getDOWStr());&lt;br /&gt;
   Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
   Serial.print(rtc.getDateStr());&lt;br /&gt;
   Serial.print(&amp;quot; -- &amp;quot;);&lt;br /&gt;
   Serial.println(rtc.getTimeStr()); &lt;br /&gt;
 &lt;br /&gt;
   // Send Unixtime&lt;br /&gt;
   // ** Note that there may be a one second difference between the current time **&lt;br /&gt;
   // ** and current unixtime show if the second changes between the two calls   **&lt;br /&gt;
   Serial.print(&amp;quot;Current Unixtime.........................: &amp;quot;);&lt;br /&gt;
   Serial.println(rtc.getUnixTime(rtc.getTime()));&lt;br /&gt;
   &lt;br /&gt;
   // Send Unixtime for 00:00:00 on January 1th 2014&lt;br /&gt;
   Serial.print(&amp;quot;Unixtime for 00:00:00 on January 1th 2014: &amp;quot;);&lt;br /&gt;
   t.hour = 0;&lt;br /&gt;
   t.min = 0;&lt;br /&gt;
   t.sec = 0;&lt;br /&gt;
   t.year = 2014;&lt;br /&gt;
   t.mon = 1;&lt;br /&gt;
   t.date = 1;&lt;br /&gt;
   Serial.println(rtc.getUnixTime(t)); &lt;br /&gt;
 &lt;br /&gt;
   // Wait indefinitely&lt;br /&gt;
   while (1) {};&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>