Robot Specific Blocks#

Looks#

Robot Looks#

Glow#

The Glow block is used to set the glow color of the indicator light in the center of the 123 Robot.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

  glow [green v]

Select which color to glow or to turn off the glow.

Glow block for the 123 Robot, setting the indicator light color, demonstrating green glow for 3 seconds.

In this example, the 123 Robot will glow green for 3 seconds before the glow turns off.

  when started
  [Start to glow green.]
  glow [green v]
  [Wait 3 seconds.]
  wait (3) seconds
  [Stop glowing green.]
  glow [off v]

Monitor Looks#

The virtual 123 Robot also has access to all standard VR Looks blocks. Go here to access documentation for the VEXcode VR Looks blocks.

Sound#

Play sound#

The Play sound block is used to play the sound effect that is selected.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

  play sound [honk v]

Select which sound effect to play.

Image of the Play Sound block used in VEXcode VR to select and play sound effects for the 123 Robot.

In this example, the 123 Robot will play a doorbell sound.

  when started
  play sound [doorbell v]

Actions#

Act#

The Act block is used to act sad, happy, or crazy by having the 123 Robot perform a sequence of drive, turn, and sound behaviors.

This is a non-waiting block and allows any subsequent blocks to execute without delay.

  act [sad v]

Select which emotion to perform.

  • Sad: The 123 Robot will drive in reverse, turn left, then right, play an ‘uh oh’ sound, and then will drive forward to mimic a sad behavior.

  • Happy: The 123 Robot will turn right 360 degrees and play a laughing sound to mimic a happy behavior.

  • Crazy: The 123 Robot will turn left in a circle, and then turn right in a circle, all while playing a ‘loopy’ sound to mimic a crazy behavior.

Image of the Glow block used to set the robot's indicator light color in VEXcode VR programming.

In this example, the 123 Robot will act crazy.

  when started
  act [crazy v]

Sensing#

The virtual 123 Robot has access to the standard Brain and Drivetrain Sensing blocks.

Eye Sensing#

Found object#

The Found object block is used to report if the Front Eye Sensor detects an object within approximately 40 millimeters (mm) or 1.5 inches.

  <eye found an object?>

The Found object block reports True when the Front Eye Sensor detects an object within approximately 40 millimeters (mm) or 1.5 inches.

The Found object block reports False when an object is not within approximately 40 millimeters (mm) or 1.5 inches.

The Found object block is used in blocks with hexagonal (six-sided) spaces.

In this example, the robot will check if its Front Eye Sensor has detected an object and print if it has or hasn’t detected anything.

  when started
  if <eye found an object?> then
  print [Eye detects an object!] ▶
  end
  print [Eye doesn't detect an object!] ▶

Detects color#

The Detects color block is used to report if the Front Eye Sensor detects the specified color of an object.

  <eye detects [red v]?>

Select which color to detect.

Image illustrating the Detects color" block used by the 123 Robot to identify specific colors with its Front Eye Sensor.

The Detects color block reports True when the Eye Sensor detects the specified color of an object.

The Detects color block reports False when the Eye Sensor does not detect the specified color of an object.

The Detects color block is used in blocks with hexagonal (six-sided) spaces.

In this example, the robot will check if its Front Eye Sensor has detected a Blue object and print if it has detected one.

  when started
  if <eye detects [red v]?> then
  print [Eye detects red object!] ▶
  end

Hue of#

The Hue of block is used to report the hue value of the color detected by the Eye Sensor.

  (eye hue in degrees)

The Hue of block provides a hue value between 0 to 359 degrees. This provides a more precise measurement of color.

Color wheel showcasing various hues for robot glow settings in programming blocks.

The Hue of block is used in blocks with circular spaces.

In this example, the robot will print the current hue of an object. Since there is no object in front of the sensor, it will print a 0.

  when started
  print (eye hue in degrees) ▶

Eye detects bright object#

The Eye detects bright object block is used to report if the Eye Sensor senses a bright or dark value.

  <eye bright object?>

The Eye detects bright object block reports True when the Eye Sensor senses a brightness value greater than 70%.

The Eye detects bright object block reports False when the Eye Sensor senses a brightness less than or equal to 70%.

The Eye detects bright object block is used in blocks with hexagonal (six-sided) spaces.

In this example, the robot will only drive forward when there is a dark brightness value (below 70%) in front of it.

  when started
  [Drive forward indefinitely.]
  drive [forward v]
  [Wait until the Front Eye Sensor detects a brightness value less than 70%]
  wait until <not <eye bright object?>>
  [Stop driving.]
  stop driving

Brightness of#

The Brightness of block is used to report the brightness of the object detected by the Eye Sensor.

    (eye brightness in %)

The Brightness of block is used in blocks with circular spaces.

In this example, the robot will print the current brightness of an object. Since there is no object in front of the sensor, it will print a 0.

  when started
  print (eye brightness in %) ▶

Gyro Sensing#

Detected crash?#

The Detected crash? block is used to report if the robot has come in contact with a wall or other object.

    <detected crash?>

The Detected crash? block reports True if the robot comes in contact with a wall or other object.

The Detected crash? block reports False if the robot does NOT come in contact with a wall or other object.

The Detected crash? block is used in blocks with hexagonal (six-sided) spaces.

In this example, the robot will drive forward until it has crashed, then it will stop moving.

    when started
    [Drive forward indefinitely.]
    drive [forward v]
    [Wait until the robot has driven into something.]
    wait until <detected crash?>
    [Stop driving.]
    stop driving