Created
July 3, 2017 15:51
-
-
Save Ryanhu1015/59078081f05ed5351e3182cd77bc78ef to your computer and use it in GitHub Desktop.
software_RTC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned long timeNow = 0; | |
unsigned long timeLast = 0; | |
int seconds = 0; | |
int minutes = 0; | |
int hours = 0; | |
int days = 0; | |
timeNow = millis()/1000;// millis is the function i have mentioned above | |
seconds = timeNow - timeLast; | |
if (seconds == 60) | |
{ | |
timeLast = timeNow; | |
minutes += 1; | |
} | |
if (minutes == 60){ | |
minutes = 0; | |
hours += 1; | |
} | |
if (hours == 24){ | |
hours = 0; | |
days += 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment