@@ -16,22 +16,31 @@ Arduino Library to implement a CountDown clock (in software polling, no hardware
1616
1717## Description
1818
19- The countdown library is a clock that counts down from a given time to zero.
20- It does not call a function or so as the user is responsible to check the time remaining.
19+ The CountDown library is a clock that counts down from a given time to zero, like an hour glass .
20+ It does not call any function or so when reaching zero as the user is responsible to check the time remaining.
2121Typically one checks the remaining time at least once in every ** loop()** .
2222
23- Under the hood the function uses ** micros()** or ** millis()** which results in a maximum time
24- of 4294 seconds in micros (1h 10m) or about 49+ days when using milliseconds.
23+ A CountDown object can be used for
24+ - to detect a timeout
25+ - to show to a user how long to wait e.g. for a traffic light to become green.
26+ - to learn count backwards (educational)
27+ - etc.
2528
26- For longer periods one could cascade countDown objects, so when one is finished the next one starts.
29+ Under the hood the CountDown object uses ** micros()** or ** millis()** which results in a maximum time
30+ of 4294 seconds in micros (about 1h 10m) or about 49+ days when using milliseconds.
2731
28- Note the countdown object is as accurate as the underlying ** millis()** or ** micros()** .
32+ For longer periods one could cascade CountDown objects, so when one is finished the next one starts.
33+
34+ Note the CountDown object is as accurate as the underlying ** millis()** or ** micros()** .
2935Interrupts etc. might cause deviations.
3036
3137
32- #### Related
38+ ### Related
3339
34- - https://github.com/RobTillaart/StopWatch_RT
40+ - https://github.com/RobTillaart/printHelpers
41+ - https://github.com/RobTillaart/stopWatch_RT
42+ - https://github.com/RobTillaart/CountDown
43+ - https://github.com/RobTillaart/timing wrappers around millis() and microc()
3544
3645
3746## Interface
@@ -40,14 +49,18 @@ Interrupts etc. might cause deviations.
4049#include " CountDown.h"
4150```
4251
52+ The main functions of the CountDown clock are straightforward:
4353
44- The main functions of the CountDown clock are:
54+ ### Constructor
4555
4656- ** CountDown(const enum Resolution res = MILLIS)** constructor, with default resolution of milliseconds.
4757- ** void setResolution(const enum Resolution res = MILLIS)** set the resolution,
48- default to MILLIS.
58+ default to MILLIS. See table below.
4959- ** enum Resolution resolution()** return the current resolution (integer).
5060- ** char getUnits()** return the current resolution as printable char (u,m,s,M)
61+
62+ ### Start / Stop functions
63+
5164- ** bool start(uint32_t ticks)** (re)start in current resolution.
5265Typical used for MILLIS and MICROS which must be set manually.
5366- ** bool start(uint8_t days, uint16_t hours, uint32_t minutes, uint32_t seconds)** Implicit set resolution to SECONDS.
@@ -57,21 +70,24 @@ Note that **remaining()** will report in SECONDS.
5770Returns false if total exceeds 2^32 milliseconds ~ 49 days.
5871Note that ** remaining()** will report in MINUTES.
5972- ** void stop()** stop the count down.
60- - ** void cont()** resumes / continue the count down.
61- * (note continue is a C-Keyword)*
73+ - ** void resume()** resumes / continues the count down.
6274- ** void restart()** restart the CountDown with the same resolution and ticks as before.
6375resets the \_ ticks and starts again.
76+
77+ Obsolete in future (0.4.0).
78+ - ** void cont()** resumes / continue the count down.
79+ * (note continue is a C-Keyword)*
80+
81+ ### Status
82+
6483- ** uint32_t remaining()** returns the remaining ticks in current resolution.
6584- ** bool isRunning()** idem.
6685- ** bool isStopped()** idem.
6786
68- These functions work straightforward.
69-
70-
7187## Operation
7288
7389The function ** start(days, hours, minutes, seconds)** allows all combinations
74- as long as the total time may not exceed 2^32 milliseconds.
90+ as long as the total time not exceeds 2^32 milliseconds.
7591The function will return false if it exceeds this (rounded) maximum.
7692Example calls are:
7793- four hundred minutes ** start(0, 0, 400, 0)**
@@ -130,7 +146,7 @@ the accuracy. E.g checking once a minute while doing milliseconds makes only sen
130146if the number of milliseconds is still very large. Think of an adaptive strategy.
131147
132148
133- #### Watchdog
149+ ### Watchdog
134150
135151One can call ** start(...)** at any time to reset the running clock to a new value.
136152This allows to implement a sort of watchdog clock in which e.g.
@@ -160,7 +176,7 @@ a repeating (timed) function or a watchdog. See examples.
160176- add resolution::HOURS + ** start(days, hours)**
161177 - extend adaptive display example
162178 - or default 00 minutes?
163-
179+ - add ** void resume() ** instead of ** cont() ** ?
164180
165181#### Wont (unless)
166182
0 commit comments