Main Content

Touch Sensor

Output state of touch sensor

Add-On Required: This feature requires the Simulink Support Package for LEGO MINDSTORMS EV3 Hardware add-on.

Library

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware

  • Touch Sensor block

Description

Detect whether the EV3 Touch Sensor is being pressed:

  • 0 = Not pressed

  • 1 = Pressed

The block output emits values as uint8.

During simulations without hardware, this block emits zeros. See Block Produces Zeros or Does Nothing in Simulation.

Parameters

EV3 brick input port

Select the EV3 sensor port to which the sensor is connected. Avoid assigning multiple devices to the same port. The options are 1, 2, 3, or 4.

Sample time

Specify how often the block reads sensor values.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.