Psuedo-event-driven potentiometer class. Events are split into stable and unstable updates to prevent flooding the mqtt channel with many messages while the slider is being set, while allowing for a local display element (i.e. an led) to give real-time feedback.
More...
#include <Potentiometer.h>
|
void | check () |
| Polls the potentiometer's value and detects events. This should be called in the sketch's loop() function. More...
|
|
int | getId () |
| Returns the potentiometer ID. More...
|
|
int | getValue () |
| Returns the current stable potentiometer value. More...
|
|
| Potentiometer (int pin, int id=99) |
| Class constructor. More...
|
|
void | setEventHandler (void(*function)(Potentiometer *, uint8_t, uint8_t)) |
| Set the function that is called any time a button event is detected. Some example callback functions can be found in the InputNode example. More...
|
|
|
static const uint8_t | kEventStableUpdate = 0 |
| Event ID for a stable update (potentiometer has been changed, then been stable longer than _interval ). More...
|
|
static const uint8_t | kEventUnstableUpdate = 1 |
| Event ID for a stable update (potentiometer has been changed, but not stopped moving yet). More...
|
|
Psuedo-event-driven potentiometer class. Events are split into stable and unstable updates to prevent flooding the mqtt channel with many messages while the slider is being set, while allowing for a local display element (i.e. an led) to give real-time feedback.
◆ Potentiometer()
Potentiometer::Potentiometer |
( |
int |
pin, |
|
|
int |
id = 99 |
|
) |
| |
◆ check()
void Potentiometer::check |
( |
| ) |
|
Polls the potentiometer's value and detects events. This should be called in the sketch's loop() function.
◆ getId()
int Potentiometer::getId |
( |
| ) |
|
Returns the potentiometer ID.
◆ getValue()
int Potentiometer::getValue |
( |
| ) |
|
Returns the current stable potentiometer value.
◆ setEventHandler()
void Potentiometer::setEventHandler |
( |
void(*)(Potentiometer *, uint8_t, uint8_t) |
function | ) |
|
Set the function that is called any time a button event is detected. Some example callback functions can be found in the InputNode example.
◆ kEventStableUpdate
const uint8_t Potentiometer::kEventStableUpdate = 0 |
|
static |
Event ID for a stable update (potentiometer has been changed, then been stable longer than _interval
).
◆ kEventUnstableUpdate
const uint8_t Potentiometer::kEventUnstableUpdate = 1 |
|
static |
Event ID for a stable update (potentiometer has been changed, but not stopped moving yet).
The documentation for this class was generated from the following file: