system
July 12, 2012, 4:22am
1
HI everyone
I am a newbie of arudino programming. Starting a project to build a reef LED controller with arduino.
My arduino mega have a LCD ,a RTC 1307 module and 4 button. I would like to able to modify the time
with button instead of setting time during upload sketch from computer. I am using the RTClib but I found
there is not such function to write time. is there a way to write time to the DS1307?
You change the first 8 bytes of the memory to update the time. The datasheet for the device shows the mapping of that memory area.
system
July 12, 2012, 7:02am
3
I thought RTCLib had an adjust() method.
system
July 12, 2012, 12:05pm
4
thank you all
i cannot find any how to document to use the RTC.adjust function. i think it is hard for me to write value to the memory area. i would like to know how to use RTC.adjust with what parameter.
system
July 12, 2012, 12:09pm
5
i cannot find any how to document to use the RTC.adjust function.
You have the source code. Look at that.
i think it is hard for me to write value to the memory area.
You should not need to. That is what the adjust() method does.
i would like to know how to use RTC.adjust with what parameter.
That would be a method of a class contained in a library that you have not provided a link to. No can do.
system
July 12, 2012, 12:31pm
6
The RTC.adjust() method takes a parameter of type DateTime.
static void adjust(const DateTime& dt);
The library also provides functions to generate a DateTime value.
DateTime (uint32_t t =0);
DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour =0, uint8_t min =0, uint8_t sec =0);
DateTime (const char* date, const char* time);
For example, you can do something like:
RTC.adjust(DateTime(2012, 7, 12, 13, 25, 30));
system
July 12, 2012, 2:17pm
9
RTC.adjust(DateTime(2012, 7, 12, 13, 25, 30));
How can i modify the hour and minute value only ? My program only need hour and minute like a alarm clock.
system
July 12, 2012, 2:20pm
10
Read the current values and use them in the adjust().
system
July 12, 2012, 2:35pm
11
RTC.adjust(DateTime(now.year(), now.month(),now.day() , set_time_hour,set_time_min ,now.second
set_time_hour and set_time_min are the modify value varible
is it what you mean?