upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Typedefs

Button library. More...

Data Structures

struct  _button_context
 API for the Button. More...
 
class  Button
 API for the Button. More...
 

Typedefs

typedef struct _button_contextbutton_context
 API for the Button. More...
 

Detailed Description

Button/Switch Library.

Typedef Documentation

typedef struct _button_context * button_context
  • ID: button
  • Name: Button
  • Other Names: Grove Button
  • Category: button
  • Manufacturer: seeed
  • Connection: gpio
  • Kit: gsk

Basic UPM module for the button sensor

button.jpg
// Create the button object using GPIO pin 0
upm::Button button(0);
// Read the input and print, waiting one second between readings
while (1) {
std::cout << button.name() << " value is " << button.value() << std::endl;
upm_delay(1);
}
// Delete the button object
Collaboration diagram for libupm-button: