Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | List of all members
ArduinoButton Class Reference

Represents a button on an Arduino pin. More...

#include <ArduinoButton.h>

Inheritance diagram for ArduinoButton:
Inheritance graph
[legend]
Collaboration diagram for ArduinoButton:
Collaboration graph
[legend]

Public Member Functions

 ArduinoButton (inputid_t id, inputpin_t pin, bool activeLow=true, bool pullUp=true)
 Creates a new button on an Arduino pin. More...
 
inputpin_t getPin () const
 Gets the pin the button is attached to. More...
 
bool isActiveLow () const
 Determines if the pin logic is active low. More...
 
bool isPullUp () const
 Determines if the pin is pulled high. More...
 
- Public Member Functions inherited from IButton
 IButton (inputid_t id, inputtime_t debounceDelay=50)
 Creates a new button. More...
 
inputtype_t type () const
 Retrieves the type of this device. More...
 
bool setDebounceDelay (inputtime_t debounce)
 Sets the debounce delay time. More...
 
inputtime_t getDebounceDelay () const
 Gets the current debounce delay time. More...
 
bool poll ()
 Polls this input device for change. More...
 
bool isActive () const
 Determines if the button is currently active. More...
 
inputtime_t lastStateChange () const
 Returns the time of the last state change. More...
 
inputtime_t lastActiveDuration () const
 Returns the duration for which the button was last active. More...
 
- Public Member Functions inherited from IInputDevice
 IInputDevice (inputid_t id)
 Creates a new input device. More...
 
inputid_t getID () const
 Retrieves the ID of this device. More...
 

Protected Member Functions

uint8_t getPhysicalState () const
 Gets the current physical state of the button. More...
 

Detailed Description

Represents a button on an Arduino pin.

Constructor & Destructor Documentation

ArduinoButton::ArduinoButton ( inputid_t  id,
inputpin_t  pin,
bool  activeLow = true,
bool  pullUp = true 
)

Creates a new button on an Arduino pin.

Parameters
idID of the button
pinPin the button is attached to
activeLowIf the button logic is active low
pullUpIf the pin should be pulled high

Member Function Documentation

uint8_t ArduinoButton::getPhysicalState ( ) const
protectedvirtual

Gets the current physical state of the button.

Returns
True if button state is high

Implements IButton.

inputpin_t ArduinoButton::getPin ( ) const
inline

Gets the pin the button is attached to.

Returns
Pin number
bool ArduinoButton::isActiveLow ( ) const
inline

Determines if the pin logic is active low.

Returns
True if active low
bool ArduinoButton::isPullUp ( ) const
inline

Determines if the pin is pulled high.

Returns
True if pull up active

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