Touch Sensor

The touch sensor detects when the front part (red) of the sensor is pressed, for instance by slowly approaching an obstacle or by simply pressing it.

Practice Task: Using the Touch Sensor

Please find a printable version of this practice task HERE.

  • Ask students to add the touch sensor to their robot. Learners can add the sensor themselves or follow pages 77-79 of their EV 3 Manual (Building Instructions).  
  • Program the robot to change the display screen when the touch sensor is touched. This means that when the touch sensor is touched it will run one chain of commands. 
    When the touch sensor is not touched it will run another chain of commands. This can be done with a <Switch Block>.

This practice task does not involve any robot movement, but it could be added on.



First, drag and drop a <Switch Block> from the orange tab on the lower menu. Select <Touch Sensor> <Compare> <State> from the switch options. (Note: The <Switch Block> of the desktop version looks slightly different in the EV3 Programmer App for mobile devices).


Drag and drop a <Display Block> from the green tab on the lower menu into the upper switch chain. The upper switch chain will run if the touch sensor is pushed. We chose a happy social robot that smiles when touched form the “Lego Image Files.”
Then add a <Display Block> to the lower switch chain. Choose a different image.


An infinite <Loop Block> needs to be added.
Otherwise the switch will evaluate once, display the appropriate image at a speed that is almost invisible to the eye, and then end the program.
The <Loop Block> will repeat the process.

Find a printable version of this task HERE.

© 2020 Dr. Krista Francis & Stefan Rothschuh