> For the complete documentation index, see [llms.txt](https://vrs-book-complete.gitbook.io/virtual-robot-simulator-official-guidebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vrs-book-complete.gitbook.io/virtual-robot-simulator-official-guidebook/programming/blocks/sensors/touchsensor.md).

# TouchSensor

This sensor is connected as a digital device and not connected via an I2C bus so it does not have an I2C address.&#x20;

**isPressed**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXedG5WR2vdRYWAA1DEb-DQuU5aQhTvp14qNwwCW56Xlb_siYS5d7s3rityz51N5_TC2vzkNbVB3bistk-AEFdwFj3d6oGaov6uJaW1wmlzfbg19OPGrzFsC-ClXUsvpHHHb6Tky18VzWxMwP72NT5wRBGwz?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Return true if the named touch sensor has been pressed, false otherwise.

Key points:

* Purpose: To determine whether the sensor is pressed or not.
* Return value: True if the sensor is pressed.
* Usage: Typically used within a loop to check whether the robot hits an object or not.
