![]() ![]() one-shot var: allow to do action only ONCE when button pressed, don't do again until switch released and Int buttonState // the current reading from the input pin Int val2 // variable for reading the switch pin status after a delay Int val // variable for reading the switch pin status RTC plugged directly onto Uno, with A2 (D17) set as gnd, A3 (D16) set as +5 (high)Ĭonst int PwrToRTC = 17 // set this as OUTPUT, and HIGH to power RTC directly from plugged into Uno boardĬonst int GndToRTC = 16 // set this as OUTPUT, and LOW for GROUND for RTC from plugged into Uno boardĬonst int buttonPin = 6 // pin number of a normally CLOSED pushbutton pin Reads Date and time from a DS1307 RTC connected via I2C and Wire lib How can I get the current time from the computer on button press to set that time into the 1307 ? Into a one-shot button press within the main loop.īut it appears that the time/date even there is always the time and date retrieved at compile, rather than the time/date at button press, that is, it just loads the time/date that was retrieved on compile every time the button is pressed instead of getting the current time and loading that time into the RTC. ![]() So, in order to set the RTC more accurately, I thought to put the time adjust statement, I see that when using RTClib to set the time in a ds1307, the time that's used to set it is the time retrieved on compile, which causes the rtc to lag real time by about 30 seconds. (AFTERWORD: the original subject intended to be, "How to set RTC ds1307 time date from computer upon press button", but I guess there's a character limit, so I shortened it to allow to indicate in the subject.)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |