Loading...
Pages: 1 [2]   Go Down
Author Topic: changing clock/date setting on Real Time Clock pcf8563 [solved]  (Read 662 times)
0 Members and 1 Guest are viewing this topic.
East Anglia (UK)
Offline Offline
Edison Member
*
Karma: 55
Posts: 1599
May all of your blinks be without delay
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Think about what value min has in the changeTime function just before rtc.setTime(hour, min,sec)
Looks to me that it will always be 20. 
Is that what you want or do you want it to be the value you set it to by pressing the button ?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 334
Posts: 36433
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On each pass through loop(), you are testing whether the switch connected to minButton is pressed. If it is, you set the time to 5:30:14, then increment the min variable and return.

You need to move the local variables hour, min, and sec from the function to global space.

Then, you need to call setTime AFTER incrementing min.
Logged

London-UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 90
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks to all. I have it working now.

This last bit solved the issue.
On each pass through loop(), you are testing whether the switch connected to minButton is pressed. If it is, you set the time to 5:30:14, then increment the min variable and return.

You need to move the local variables hour, min, and sec from the function to global space.

Then, you need to call setTime AFTER incrementing min.

Karma awarded.
Logged

Pages: 1 [2]   Go Up
Print
 
Jump to: