EV3TouchSensor#

class EV3TouchSensor#

Class to interact with the EV3 Touch Sensor.

Initialisation & Setup

EV3TouchSensor::EV3TouchSensor(SensorPort port)#

Constructs an EV3TouchSensor object.

Parameters:

port – The sensor port the touch sensor is connected to.

int EV3TouchSensor::getButton()#

Gets the state of the button.

Returns:

The state of the button. (0 = RELEASED, 1 = PRESSED).

void EV3TouchSensor::waitForPress(int debouncems = 200)#

Waits for the button pressed before continuing execution.

Parameters:

debouncems – Delay in milliseconds after button is pressed.

void EV3TouchSensor::waitForRelease(int debouncems = 200)#

Waits for the button released before continuing execution.

Parameters:

debouncems – Delay in milliseconds after button is released.

void EV3TouchSensor::waitForBump(int debouncems = 200)#

Waits for the button pressed and released before continuing execution.

Parameters:

debouncems – Delay in milliseconds after button is pressed and released.