Skip to content

Instantly share code, notes, and snippets.

@edgardmota
Created November 16, 2016 02:04
Show Gist options
  • Save edgardmota/96a16c356ab3de1b1512dcd38442e8fb to your computer and use it in GitHub Desktop.
Save edgardmota/96a16c356ab3de1b1512dcd38442e8fb to your computer and use it in GitHub Desktop.
const unsigned long MILI_MAX = 4294967295;
const unsigned long MILI_30_DIAS = 2592000000;
unsigned long mili_ant = 0;
unsigned long mili_atual;
unsigned long mili_dif;
void loop(){
mili_atual = millis();
if (mili_atual > mili_ant)
mili_dif = mili_atual - mili_ant;
else
mili_dif = (MILI_MAX - mili_ant) + mili_atual;
if (mili_dif >= MILI_30_DIAS) {
mili_ant = milli();
alterna_unidades_refri();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment