mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
46 lines
831 B
C++
46 lines
831 B
C++
//
|
|
// FILE: countdown_setResolution.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// VERSION: 0.1.0
|
|
// PURPOSE: demo
|
|
// DATE: 2021-05-26
|
|
// URL: http://forum.arduino.cc/index.php?topic=356253
|
|
// https://github.com/RobTillaart/CountDown
|
|
//
|
|
|
|
|
|
#include "CountDown.h"
|
|
|
|
CountDown CD;
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println(__FILE__);
|
|
Serial.print("COUNTDOWN_LIB_VERSION: ");
|
|
Serial.println(COUNTDOWN_LIB_VERSION);
|
|
|
|
CD.setResolution(CountDown::MINUTES);
|
|
// countdown 1 minutes
|
|
CD.start(1);
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
static uint32_t last_remaining = 0;
|
|
if (last_remaining != CD.remaining() || CD.remaining() == 0 )
|
|
{
|
|
Serial.println();
|
|
last_remaining = CD.remaining();
|
|
}
|
|
Serial.print(' ');
|
|
Serial.print(CD.remaining());
|
|
delay(5000); // every 5 seconds
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|
|
|