EV3RT CXX API Reference [English]
An RTOS-based development platform for LEGO Mindstorms EV3.
ev3cxx_button.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "ev3api.h"
10 
11 namespace ev3cxx {
12 
13 namespace detail {
14 
19 class Button
20 {
21 public:
27  virtual int isPressed() = 0;
28 
33  void waitForPress() {
34  while (!isPressed())
35  tslp_tsk(1);
36  }
37 
42  void waitForRelease() {
43  while (isPressed())
44  tslp_tsk(1);
45  }
46 
51  void waitForClick() {
52  waitForPress();
54  }
55 
56 
57 }; // class Button
58 
59 } // namespace detail
60 
61 } // namespace ev3cxx
Definition: ev3cxx.h:35
void waitForRelease()
Blocks until button is release.
Definition: ev3cxx_button.h:42
void waitForClick()
Blocks until button is clicked (press and release)
Definition: ev3cxx_button.h:51
virtual int isPressed()=0
Get state of touch sensor.
Class Button. API for working with general button buttons.
Definition: ev3cxx_button.h:19
void waitForPress()
Blocks until button is pressed.
Definition: ev3cxx_button.h:33