markuslange / arduino-due-rtc-library Goto Github PK
View Code? Open in Web Editor NEWRTC Library for the Arduino Due
RTC Library for the Arduino Due
The SAM supports validating time/date/etc. by register RTC_VER. I assume, that that register reports invalid values when the SAM comes up. It would be very useful for me, to check if its necessary to synchronize the time by NTC.
thank for lib
how to get int for hour minutes and second
I noticed that if the Due is programmed using this library, the date will only be correct if the unit is not powered down. If you program the time in by uncommenting out the rtc_clock.set lines to 'burn' the current time to the RTC, then commen them out to burn the rest of the program onto the chip, then upon restart of the unit the time reverts to 1/1/2007 0:0:0.
Expected behavior is rtc_clock.get should return the current time, regardless of how long the due has been powered down. My test code is below, and it's likely that I'm doing something wrong or not understanding something about the library!
// Select the Slowclock source
RTC_clock rtc_clock(XTAL);
unsigned int currentTime = 0;
unsigned int prevTime = 0;
unsigned int prevSerialTime = 0;
/////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
//rtc_clock.init();
//rtc_clock.set_time(TIME);
//rtc_clock.set_date(DATE);
//Only run these once to setup the RTC clock (assuming the clock has a good battery)
}
/////////////////////////////////////////////////////////////////////////
void loop() {
currentTime = millis();
if (currentTime - prevSerialTime > 5000) {
prevSerialTime = currentTime;
String dataString = "";
dataString += rtc_clock.get_months();
dataString += "/";
dataString += rtc_clock.get_days();
dataString += "/";
dataString += rtc_clock.get_years();
dataString += " ";
dataString += rtc_clock.get_hours();
dataString += ":";
dataString += rtc_clock.get_minutes();
dataString += ":";
dataString += rtc_clock.get_seconds();
dataString += ",";
dataString += "data1";
dataString += ",";
dataString += "data2";
Serial.println(dataString);
}
}
Can you please check the date in the output of Due_RTC_Simple_Sample_oneline_time_and_date example?
I always get
Date: Mon 01.01.2007
I use RTC_clock rtc_clock(RC);
other question why XTAL doesn't work and what is this option exactly?
thanks
Hi Markus,
Great library !
Found little issue while checking the examples:
In the second and third example (Simple_German_Summertime and Simple_German_Timing_Summertime there is a difference. The Due_RTC.timing() function is called. Due_RTC.timing() function seems to be required to correctly return the summertime YES/NO value.
In the CPP there is indeed a call for the meztime variable,(mez =CET for non German speaking !) which is set in the Due_RTC.timing() function.
This explains why the Simple_German_Summertime.ino is not working correctly.
You may want to change the Summertime() function to avoid calling the meztime variable.
Thank you for your nice library. Installed your newest version and ran the second summertime example. There is a problem in the Simple _German_summertime example:
Apparently the example is not working
The example keeps returning "Summer time: No".
Do I make a mistake somewhere?
Markus,
Can you please test this library on a Due now? I am finding some issues when setting date, and I think it is probably because of leapyear?
Hello Markus,
is there a way to set the time from a unix timestamp ?
This can be useful when requesting time from NTP server.
Thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.