Pages: 1 [2]   Go Down
Author Topic: changing clock/date setting on Real Time Clock pcf8563 [solved]  (Read 2447 times)
0 Members and 1 Guest are viewing this topic.
East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4267
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

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 616
Posts: 49444
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
Full Member
***
Karma: 1
Posts: 106
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
Jump to: