Easyuino  1.2.0
Easyuino::Button Class Reference

Button API offers an interface to interact with common buttons. More...

#include <Button.h>

Inheritance diagram for Easyuino::Button:
Easyuino::Device

Public Member Functions

 Button (IN uint8_t buttonPin)
 Constructor. More...
 
 ~Button ()
 Destructor.
 
bool begin ()
 Used to put the device ready to receive requests. More...
 
void end ()
 Used to stop the device API. More...
 
bool isPressed ()
 Verifies if the button is pressed. More...
 
unsigned long getPressedTimeMilliseconds ()
 Return the the time since it is being pressed. More...
 
unsigned int getPressedTimeSeconds ()
 Return the the time since it is being pressed. More...
 
- Public Member Functions inherited from Easyuino::Device
 Device ()
 Constructor called by every sub-classes.
 
 ~Device ()
 Destroy all the resources associated with the device.
 
bool isInitialized () const
 Verify is the device is initialized and ready to use. More...
 

Additional Inherited Members

- Protected Attributes inherited from Easyuino::Device
bool _isInitialized
 Used to know if the device API is initialized and ready to receive requests.
 

Detailed Description

Button API offers an interface to interact with common buttons.

See also
Devices Supported: Touch Button v1.0, Push Buttons
Devices Tested: Touch Button v1.0

Constructor & Destructor Documentation

◆ Button()

Easyuino::Button::Button ( IN uint8_t  buttonPin)

Constructor.

Parameters
buttonPinArduino pin that is connected to button pin

Member Function Documentation

◆ begin()

bool Easyuino::Button::begin ( )
virtual

Used to put the device ready to receive requests.

Normally this have some default behaviour some devices have other overload method with same name that receives other arguments to device customization.

Returns
True: If the device was initialized. False: Otherwise.

Implements Easyuino::Device.

◆ end()

void Easyuino::Button::end ( )
virtual

Used to stop the device API.

After this the the device will not process API requests.

Implements Easyuino::Device.

◆ getPressedTimeMilliseconds()

unsigned long Easyuino::Button::getPressedTimeMilliseconds ( )

Return the the time since it is being pressed.

Returns
pressedTime Time since the button started being pressed (Milliseconds) OR 0 if button is not being pressed

◆ getPressedTimeSeconds()

unsigned int Easyuino::Button::getPressedTimeSeconds ( )

Return the the time since it is being pressed.

Returns
pressedTime Time since the button started being pressed (Seconds) OR 0 if button is not being pressed

◆ isPressed()

bool Easyuino::Button::isPressed ( )

Verifies if the button is pressed.

Returns
isPressed True: If button is currently being pressed. False: Otherwise.

The documentation for this class was generated from the following file: