EV3RT CXX API Reference [English]
An RTOS-based development platform for LEGO Mindstorms EV3.
TouchSensor Class Reference

Class TouchSensor. API for working with touch sensor. More...

#include <ev3cxx_touch_sensor.h>

Inheritance diagram for TouchSensor:
Sensor Button

Public Member Functions

 TouchSensor (SensorPort port)
 Constructor of class TouchSensor. More...
 
int isPressed ()
 Get state of touch sensor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Sensor
 Sensor (SensorPort port, sensor_type_t type)
 Constructor of class Sensor. More...
 
virtual ~Sensor ()
 Destructor of class Sensor.
 
sensor_port_t getPort ()
 Get sensor port set in constructor. More...
 
sensor_type_t getType ()
 Get actual sensor type. More...
 
- Protected Attributes inherited from Sensor
sensor_port_t m_port
 
sensor_type_t m_type
 
- Private Member Functions inherited from Button
void waitForPress ()
 Blocks until button is pressed.
 
void waitForRelease ()
 Blocks until button is release.
 
void waitForClick ()
 Blocks until button is clicked (press and release)
 

Detailed Description

Class TouchSensor. API for working with touch sensor.

Definition at line 21 of file ev3cxx_touch_sensor.h.

Constructor & Destructor Documentation

◆ TouchSensor()

TouchSensor ( SensorPort  port)
inline

Constructor of class TouchSensor.

Parameters
portPort index (1-4).

Definition at line 29 of file ev3cxx_touch_sensor.h.

29 : Sensor(port, TOUCH_SENSOR) {}
Sensor(SensorPort port, sensor_type_t type)
Constructor of class Sensor.
Definition: ev3cxx_sensor.h:38

Member Function Documentation

◆ isPressed()

int isPressed ( )
inlinevirtual

Get state of touch sensor.

Returns
If is pressed return , else .

Implements Button.

Definition at line 36 of file ev3cxx_touch_sensor.h.

36  {
37  return ev3_touch_sensor_is_pressed(m_port);
38  }