Skip to main content
added 2 characters in body
Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

delay()delay() takes an unsigned long; I think what you do will work.

When in doubt, you could always do something like this:

for (int hours = 0; hours < 24; hours++) {
  for (int mins = 0; mins < 60; mins++) {    
    for (int secs = 0; secs < 60; secs++) {  
      delay(1000);                                    
    }
  }
}

It will be wildly inaccurate though, because the clock is inaccurate and will also drift with temperature, made worse because a resonator is used instead of a crystal.

You will get nowhere near an accuracy of a few minutes per month this way, whatever "delaying" method you use; the hardware isn't up to it.

delay() takes an unsigned long; I think what you do will work.

When in doubt, you could always do something like this:

for (int hours = 0; hours < 24; hours++) {
  for (int mins = 0; mins < 60; mins++) {    
    for (int secs = 0; secs < 60; secs++) {  
      delay(1000);                                    
    }
  }
}

It will be wildly inaccurate though, because the clock is inaccurate and will also drift with temperature, made worse because a resonator is used instead of a crystal.

You will get nowhere near an accuracy of a few minutes per month this way, whatever "delaying" method you use; the hardware isn't up to it.

delay() takes an unsigned long; I think what you do will work.

When in doubt, you could always do something like this:

for (int hours = 0; hours < 24; hours++) {
  for (int mins = 0; mins < 60; mins++) {    
    for (int secs = 0; secs < 60; secs++) {  
      delay(1000);                                    
    }
  }
}

It will be wildly inaccurate though, because the clock is inaccurate and will also drift with temperature, made worse because a resonator is used instead of a crystal.

You will get nowhere near an accuracy of a few minutes per month this way, whatever "delaying" method you use; the hardware isn't up to it.

Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

delay() takes an unsigned long; I think what you do will work.

When in doubt, you could always do something like this:

for (int hours = 0; hours < 24; hours++) {
  for (int mins = 0; mins < 60; mins++) {    
    for (int secs = 0; secs < 60; secs++) {  
      delay(1000);                                    
    }
  }
}

It will be wildly inaccurate though, because the clock is inaccurate and will also drift with temperature, made worse because a resonator is used instead of a crystal.

You will get nowhere near an accuracy of a few minutes per month this way, whatever "delaying" method you use; the hardware isn't up to it.