Rearrange docu in /help and correct some examples

This commit is contained in:
fauresystems
2019-11-15 19:27:07 +01:00
parent ea0a9425d1
commit 447f33f62c
29 changed files with 157 additions and 96 deletions
+57
View File
@@ -0,0 +1,57 @@
# *PropsAction* class reference
*PropsAction* brings asynchronous-like behavior to sketch `loop()`.
## Constructors
* `PropsAction()`
* `PropsAction(unsigned long interval, void (*function)())`
`function` is the callback executed at every `interval` milliseconds.
## Members
* `void reset(unsigned long interval)`
* `void disable()`
* `void enable()`
* `void check()`
* `bool tick()`
* `unsigned long getInterval()`
## Usage
### Create a callback
```csharp
void clignote()
{
if (clignoter.value()) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
led.setValue(digitalRead(LED_BUILTIN));
}
}
```
### Create a *PropsAction* instance
```csharp
PropsAction clignoteAction = PropsAction(1000, clignote); // interval every 1000 milliseconds
```
### Call the instance `check()` method ine the sketch `loop()`
```csharp
void loop()
{
...
clignoteAction.check(); // do your stuff, don't freeze the loop with delay() calls
...
}
```
## Author
**Marie FAURE** (Oct 18th, 2019)
* company: FAURE SYSTEMS SAS
* mail: *dev at faure dot systems*
* github: <a href="https://github.com/fauresystems?tab=repositories" target="_blank">fauresystems</a>
* web: <a href="https://www.live-escape.net/" target="_blank">Live Escape Grenoble</a>