sensors.TouchSensor

class sensors.TouchSensor(port: Optional[int] = None)

Sensor for detecting small linear contact forces.

pressed() bool

Whether the button more than half way depressed.

pressed_stream() streams.Stream[bool]

A stream of pressed() values.

force()

The force in newtons that the tip of the button is applying to the base.

A slight filter is applied. For an unfiltered version see force_stream().

force_stream()

A stream of unfiltered force() values.

name() str

Returns the user editable name of the controllable as found in the properties tab of the game.

from ports import PortReference

print(PortReference(0).name())