Used to monitor a pin. Can monitor if a pin value changes more or less than something and can monitor if a certain amount of time has passed.
More...
|
| PinWatch (GPin *gPin, unsigned int pinValueMargin, int sampleTotalCount, unsigned long sampleInterval, unsigned long minLogInterval) |
| PinWatch. More...
|
|
| PinWatch (const PinWatch &pinWatch) |
| Copy constructor, not used by default More...
|
|
void | serialPrintValues () |
|
void | serialPrintLnValues () |
|
bool | check (unsigned long currentTimeInMillis) |
| Checks if enough time has passed sinse the last check More...
|
|
void | reset (unsigned long currentTimeInMillis, bool updateLastPinValue=true, bool updateMinLogInterval=true) |
| Resets the timer sampleInterva and if update parameters are both true, update the last pin value and the minLogInterval timer as well. More...
|
|
int | getPinNumber () |
| Get a number of the pin (not the index of a pin) More...
|
|
int | getPinValue () |
| Get a value of a pin More...
|
|
int | getPinType () |
| Get a pin type (PINTYPE) as a integer More...
|
|
bool | isValidPin () |
| Checks if a pin is valid More...
|
|
String | toJson () |
| Exports the object to a Json string More...
|
|
Used to monitor a pin. Can monitor if a pin value changes more or less than something and can monitor if a certain amount of time has passed.
PinWatch::PinWatch |
( |
GPin * |
gPin, |
|
|
unsigned int |
pinValueMargin, |
|
|
int |
sampleTotalCount, |
|
|
unsigned long |
sampleInterval, |
|
|
unsigned long |
minLogInterval |
|
) |
| |
PinWatch.
Constructor for a PinWatch
- Parameters
-
gPin | Valid GPin to watch |
pinValueMargin | How much must a value of a pin change to recive a positive check |
sampleTotalCount | How many samples of a pin value should be averaged |
sampleInterval | How many milliseconds must pass between a sample is taken from a pin value |
minLogInterval | How many milliseconds between forsed positive checks (f.example how many milliseconds between logs) Pin values are not taken into account here |
- Returns
- True if a PinWatch is added to the list, otherwise false
PinWatch::PinWatch |
( |
const PinWatch & |
pinWatch | ) |
|
Copy constructor, not used by default
- Parameters
-
pinWatch | The other object to copy values from |
bool PinWatch::check |
( |
unsigned long |
currentTimeInMillis | ) |
|
Checks if enough time has passed sinse the last check
- Parameters
-
currentTimeInMillis | The time that must pass before a check returns true |
- Returns
- true if enough time has passed. false if not.
int PinWatch::getPinNumber |
( |
| ) |
|
Get a number of the pin (not the index of a pin)
- Returns
- Success: Returns the number of the pin. Fail: Returns -1
int PinWatch::getPinType |
( |
| ) |
|
Get a pin type (PINTYPE) as a integer
- Returns
- Success: Returns a positive integer value. Fail: Returns -1
int PinWatch::getPinValue |
( |
| ) |
|
Get a value of a pin
- Returns
- Success: Returns the value of the pin. Fail: Returns -1
bool PinWatch::isValidPin |
( |
| ) |
|
void PinWatch::reset |
( |
unsigned long |
currentTimeInMillis, |
|
|
bool |
updateLastPinValue = true , |
|
|
bool |
updateMinLogInterval = true |
|
) |
| |
Resets the timer sampleInterva and if update parameters are both true, update the last pin value and the minLogInterval timer as well.
- Parameters
-
currentTimeInMillis | Current time usually gotten with the millis() function |
updateLastPinValue | If true, the last pin value is updated with the current one and reset the minLogInterval as well |
updateMinLogInterval | If True, reset the minLogInterval as well |
- Returns
- Success:The index of the pinWatch in the list. fail : -1 if the pin number was not found.
String PinWatch::toJson |
( |
| ) |
|
Exports the object to a Json string
- Returns
- A json object String
The documentation for this class was generated from the following file: