I am new in using RTC. I have Deadon RTC "(DS3234) and Arduino Uno . Would like to use DS3234 to turn Arduino pins High/Low at certain time of the year. I would like to be let we say turn pin High from 1st of April 2016 at 6:00:00 till 1st of June 2016 6:00:00. Any help or example of such a sample code?
astronaut71:
Using Time library then I dont need RTC DS3234? I can do that with Arduino not using RTC DS3234?
You should keep your RTC!
Actually, I think you would have to use a DS3234 library also, since it's SPI if I recall correctly. You would have to register the 3234 as a sync provider. It can be done, but if you're not comfortable with that, just use the library that guix linked to and manipulate the times yourself.
struct ts t;
DS3234_get( SS, &t ); // SS is pin 10 on most Arduino boards, 53 on Mega 2560. This is where you should have connected the CS pin of DS3234. Change if needed.
uint32_t now = get_unixtime( t );
Serial.println( now );
I can't test as I don't have a DS3234, also this library is the first one I found on google, there may be others, possibly better, Arduino libraries for DS3234.
I got the current time in Unix time stamp with the code suggested from guix but its not the good one. I got this time stamp: 1907255969 which correspond to GMT: Sun, 09 Jun 2030 17:19:29 GMT. How can I get exactly "today" time stamp in Unix time?
astronaut71:
I got the current time in Unix time stamp with the code suggested from guix but its not the good one. I got this time stamp: 1907255969 which correspond to GMT: Sun, 09 Jun 2030 17:19:29 GMT. How can I get exactly "today" time stamp in Unix time?
How can you be sure that your RTC is set correctly?