Go Down

Topic: changing clock/date setting on Real Time Clock pcf8563 [solved] (Read 3093 times) previous topic - next topic

UKHeliBob

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 ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PaulS

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.

mark7w

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.

Go Up