Rtc seconds count not updating
You'd have to program in the date and time and you could have it count from that point on.
But if it lost power, you'd have to reset the time.
So, basically, the upshot here is that you should never ever remove the battery once you've set the time.
You shouldn't have to and the battery holder is very snug so unless the board is crushed, the battery won't 'fall out' This line is very cute, what it does is take the Date and Time according the computer you're using (right when you compile the code) and uses that to program the RTC.
Much like very cheap alarm clocks: every time they lose power they blink While this sort of basic timekeeping is OK for some projects, a data-logger will need to have consistent timekeeping that doesnt reset when the Arduino battery dies or is reprogrammed. The RTC chip is a specialized chip that just keeps track of time.
It can count leap-years and knows how many days are in a month, but it doesn't take care of Daylight Savings Time (because it changes from place to place) You MUST have a coin cell installed for the RTC to work, if there is no coin cell, it will act strangely and possibly hang the Arduino when you try to use it, so ALWAYS make SURE there's a battery installed, even if it's a dead battery.
If you compile and then upload later, the clock will be off by that amount of time.
And now that you're bored to death listening to your in-laws and other relatives talk about the endless minutiae of their lives, here's a profound problem you might consider pondering while drowsing over your third helping of peas and mashed potatoes: I've been using a DS1307 Real Time Clock, which seems to work great while on normal power.The Arduino doesnt know its 'Tuesday' or 'March 8th' all it can tell is 'Its been 14,000 milliseconds since I was last turned on'.OK so what if you wanted to set the time on the Arduino?The RTC is an i2c device, which means it uses 2 wires to to communicate.These two wires are used to set the time and retrieve it.