Obstacle

OBSTACLE blocks monitor the two IR LEDs (emitters) and receiver on the front of the Scribbler 3 Robot.


detect obstacle

The detect obstacle block has 2 selectable conditions. If the obstacle sensor readings match the block conditions selected by the user, the detect obstacle block provides a value of true or false.

The first condition determines whether the block returns true (if the obstacle is detected) or false (if the obstacle is not detected).

The second condition determines what the obstacle sensor readings should be, with the following options:

  • in front: consider a detection successful if one or more obstacles are in front of both sensors
  • to the left: consider a detection successful if one or more obstacles are in front of the left sensor, but no obstacles are in front of the right sensor
  • to the right: consider a detection successful if one or more obstacles are in front of the right sensor, but no obstacles are in front of the left sensor
  • on either side: consider a detection successful if one or more obstacles are in front of either sensor

DEPRECATED: detect obstacle (old version)

This block has been deprecated.  It will still work in programs that already contain it, but it is not available in new programs.  It may also appear orange, signifying that it should be replaced as soon as possible.  This block has been replaced to provide more flexibility by allowing both if and else conditions when combined with the if...do block.

The functionality of this block can be recreated using a handful of other blocks. Most users will be able to combine the if...do block with the current detect line block:

For users who needed the functionality provided by the "was" and "was not" conditions, you can set up two variables to track the current and past values of the line sensor: