The LEGO MINDSTORMS EV3 robot, in this example, uses the switch block with the touch sensor to move forward or backward depending on the button's state.
In this LEGO MINDSTORMS EV3 example, the ultrasonic, loop and motor blocks are used to program a robot that moves forward until an object is detected and the…