upm  1.2.0
Sensor/Actuator repository for libmraa (v1.6.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
Button Class Reference

API for the Button. More...

Detailed Description

Basic UPM module for the button sensor

button.jpg
// Create the button object using GPIO pin 0
upm::Button* button = new upm::Button(0);
// Read the input and print, waiting one second between readings
while( 1 ) {
std::cout << button->name() << " value is " << button->value() << std::endl;
sleep(1);
}
// Delete the button object
delete button;

Public Member Functions

 Button (unsigned int pin)
 
 ~Button ()
 
std::string name ()
 
int value ()
 
void installISR (mraa::Edge level, void(*isr)(void *), void *arg)
 
void uninstallISR ()
 

Constructor & Destructor Documentation

Button ( unsigned int  pin)

button constructor

Parameters
pinPin to use
~Button ( )

button destructor

Member Function Documentation

std::string name ( )

Gets the name of the sensor

Returns
Name of this sensor
int value ( )

Gets the value from the GPIO pin

Returns
Value from the GPIO pin
void installISR ( mraa::Edge  level,
void(*)(void *)  isr,
void *  arg 
)

Installs an interrupt service routine (ISR) to be called when the button is activated or deactivated.

Parameters
fptrPointer to a function to be called on interrupt
argPointer to an object to be supplied as an argument to the ISR.
void uninstallISR ( )

Uninstalls the previously installed ISR


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