This block works for both EV3 Robot and Ruby Robot!
The Get Touch is Pressed block allows you to sample the state of the robot's touch sensor/s. It is very useful for touching objects and knowing when to stop driving!
In this example code for EV3 Robot, the loop will continue until the condition is true, meaning until the touch sensor is pressed. Once it is pressed, the robot will stop.
In this example code for Ruby Robot, the robot will drive forward until the touch sensor is pressed, and once it is, the robot will drive backward for half a second before turning 90 degrees to the right.
Note: Get Touch is Pressed block can also be used in a comparison block and compared to a true/false block set to 'true'. The result will be the same.
See also:
Wait Until Touch (EV3)
Comments
Please sign in to leave a comment.