TouchSensor

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

isPressed

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.