2015-10-29 09:28:29 -04:00
|
|
|
//
|
|
|
|
// FILE: countdown_demo2.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
2017-07-16 05:46:43 -04:00
|
|
|
// VERSION: 0.1.0
|
2015-10-29 09:28:29 -04:00
|
|
|
// PURPOSE: demo
|
|
|
|
// DATE: 2015-10-28
|
|
|
|
// URL: http://forum.arduino.cc/index.php?topic=356253
|
2021-01-29 06:31:58 -05:00
|
|
|
// https://github.com/RobTillaart/CountDown
|
2015-10-29 09:28:29 -04:00
|
|
|
//
|
|
|
|
|
2021-10-19 15:40:11 -04:00
|
|
|
|
2015-10-29 09:28:29 -04:00
|
|
|
#include "CountDown.h"
|
|
|
|
|
|
|
|
CountDown CD[5];
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
uint8_t lines = 0;
|
|
|
|
|
2021-10-19 15:40:11 -04:00
|
|
|
|
2015-10-29 09:28:29 -04:00
|
|
|
void setup()
|
|
|
|
{
|
2020-11-27 05:10:47 -05:00
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
Serial.print("COUNTDOWN_LIB_VERSION: ");
|
|
|
|
Serial.println(COUNTDOWN_LIB_VERSION);
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
CD[i].start(10000UL * i);
|
|
|
|
}
|
|
|
|
delay(1234);
|
|
|
|
CD[3].stop();
|
2015-10-29 09:28:29 -04:00
|
|
|
}
|
|
|
|
|
2021-10-19 15:40:11 -04:00
|
|
|
|
2015-10-29 09:28:29 -04:00
|
|
|
void loop()
|
|
|
|
{
|
2020-11-27 05:10:47 -05:00
|
|
|
if (lines == 10)
|
|
|
|
{
|
|
|
|
lines = 0;
|
2015-10-29 09:28:29 -04:00
|
|
|
Serial.println();
|
2020-11-27 05:10:47 -05:00
|
|
|
}
|
|
|
|
lines++;
|
2015-10-29 09:28:29 -04:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(CD[i].remaining());
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(CD[i].isRunning());
|
|
|
|
}
|
|
|
|
Serial.println();
|
2015-10-29 09:28:29 -04:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
if (CD[1].isRunning() == false && CD[3].isRunning() == false)
|
|
|
|
{
|
|
|
|
uint32_t x = CD[3].remaining();
|
|
|
|
CD[3].start(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
delay(250);
|
2015-10-29 09:28:29 -04:00
|
|
|
}
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2021-10-19 15:40:11 -04:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
// -- END OF FILE --
|
2021-10-19 15:40:11 -04:00
|
|
|
|