HomeWaterLeaksDetection
|
#include <Button.h>
Public Member Functions | |
Button (int pin) | |
Constructor of the class. More... | |
int | isPressed () |
Tests if the button is being pressed. More... | |
Private Attributes | |
int | pin |
number of the pin the button si connected to More... | |
int | currentInputValue |
current state of the input pin More... | |
int | previousInputValue |
previous state of the input pin More... | |
This class sepresents the reset button the user is required to press after a water leak has been detected of they want to reset the device.
Button::Button | ( | int | pin | ) |
Constructor of the class.
pin | number of the pin the button si connected to |
Definition at line 3 of file Button.cpp.
References currentInputValue, pin, and previousInputValue.
int Button::isPressed | ( | ) |
Tests if the button is being pressed.
It reads the state of the input pin if it has gone from LOW to HIGH, the method will return 1 as the button is being pressed.
Definition at line 10 of file Button.cpp.
References currentInputValue, pin, and previousInputValue.
Referenced by LeaksController::update().
|
private |
current state of the input pin
Definition at line 18 of file Button.h.
Referenced by Button(), and isPressed().
|
private |
number of the pin the button si connected to
Definition at line 17 of file Button.h.
Referenced by Button(), and isPressed().
|
private |
previous state of the input pin
Definition at line 19 of file Button.h.
Referenced by Button(), and isPressed().