So I'm working on a project that uses a servo at a specific time.
I have 2 problems:
1: My RTC doesn't keep track of time when it's turned off, when turning on again it will use the time that it got the last time I synced it with my PC.
2: The RTC doesn't want to work when the serial monitor isn't open
bvernimmen:
1: My RTC doesn't keep track of time when it's turned off, when turning on again it will use the time that it got the last time I synced it with my PC.
Just like you told it to do, if that's a problem, why are you doing it?
Whandall:
Just like you told it to do, if that's a problem, why are you doing it?
rtc.adjust(DateTime(F(__DATE__),F(__TIME__)));
it uses the time of the last time I synced it, I used this code once just to get my time on the rtc so I could work with it. Turning on the arduino with rtc, I don't run the code again so the time won't get synced again.
Have you got a sketch that does nothing but read the rtc (which would have been set in a different sketch) and displays the rtc's (idea of) time in the monitor?
Whandall:
So you are posting code that is not running? Why?
I think I misundedrstood, are you saying that this after I used this line of code once, I should remove it since it is preventing the time to change in real time?
Whandall:
It will set the time to the last compilation time each time it resets.
that makes a lot more sense, thanks.
The only problem i have right now is that the time is 8 seconds off, when I tried this yesterday it was always different. Is there any possible solution to fix this?
There's probably a way of hard-coding your time of choice into rtc.adjust() instead of the compile time. Then have a separate set time sketch with a value a bit ahead of the actual time, and hit reset when that actual time arrives on your watch.