Robot-Specific Blocks#

Introduction#

The VIQRC 23-24 Full Volume Playground features blocks exclusive to the build designed for this Playground, including two motor options and its Optical Sensor.

All standard VEXcode VR Blocks are available for use in the VIQRC 23-24 Full Volume Playground.

Below is a list of all available Playground-specific Blocks:

Motion – Move and track the robot’s motors.

  • Actions

    • spin motor – Spins the selected motor or motor group indefinitely.

    • spin motor for – Spins a motor or group for a specific distance in degrees or turns.

    • spin motor to position – Spins a motor or motor group to a set position.

    • stop motor – Stops a specific motor or motor group from spinning.

  • Settings

    • set motor velocity – Sets the speed of a motor or motor group as a percentage.

    • set motor timeout – Limits how long a motor block waits before giving up if movement is blocked.

  • Position

    • motor position – Returns the motor’s current rotational position in degrees or turns.

    • set motor position – Sets the encoder value of a motor or motor group.

  • Values

    • motor is done? – Returns a Boolean indicating whether the motor is no longer spinning.

    • motor is spinning? – Returns a Boolean indicating whether the motor is currently spinning.

    • motor velocity – Returns the motor’s current velocity in %.

Sensing – Utilize the robot’s various sensors.

The examples on this page use the default Playground start position.

Motion#

Actions#

spin motor#

The spin motor block spins a selected motor or motor group in a specified direction using the current motor velocity.

spin [IntakeMotorGroup v] [intake v]

Parameters

Description

motor

The motor group to spin:

  • IntakeMotorGroup
  • ArmMotorGroup

direction

The direction to spin:

  • IntakeMotorGroup
    • intake
    • outtake
  • ArmMotorGroup
    • up
    • down

Example

cuando empezó
[Spin the intake before stopping.]
spin [IntakeMotorGroup v] [intake v]
esperar (1) segundos
stop [IntakeMotorGroup v]

spin motor for#

The spin motor for block spins a selected motor or motor group for a specific amount of rotation using the current motor velocity, measured in degrees or turns.

spin [IntakeMotorGroup v] [intake v] for (90) [degrees v] ▶

Parameters

Description

motor

The motor group to spin:

  • IntakeMotorGroup
  • ArmMotorGroup

direction

The direction to spin:

  • IntakeMotorGroup
    • intake
    • outtake
  • ArmMotorGroup
    • up
    • down

distance

The rotation amount, as an integer or decimal.

unit

The unit of measurement:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

cuando empezó
[Spin the intake before stopping.]
spin [IntakeMotorGroup v] [intake v] for [200] [degrees v] ▶

spin motor to position#

The spin motor to position block spins a motor or motor group to a specific absolute position using the current motor velocity and motor position.

spin [IntakeMotorGroup v] to position (90) [degrees v] ▶

Parameters

Description

motor

The motor group to spin:

  • IntakeMotorGroup
  • ArmMotorGroup

position

The target position to spin to.

unit

The unit of measurement:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

cuando empezó
[Spin the intake before stopping.]
spin [IntakeMotorGroup v] to position [350] [degrees v] ▶

stop motor#

The stop motor block immediately stops the selected motor or motor group.

stop [IntakeMotorGroup v]

Parameters

Description

motor

The motor group to stop:

  • IntakeMotorGroup
  • ArmMotorGroup

Example

cuando empezó
[Spin the intake before stopping.]
spin [IntakeMotorGroup v] [up v]
esperar (1) segundos
stop [IntakeMotorGroup v]

Settings#

set motor velocity#

The set motor velocity block sets the default spinning speed of a motor or motor group as a percentage for all subsequent Motor blocks in the project.

set [IntakeMotorGroup v] velocity to [50] [% v]

Parameters

Description

motor

The motor group to set:

  • IntakeMotorGroup
  • ArmMotorGroup

velocity

Sets the default movement velocity from 0 to 100 as a percent.

unit

The unit that represents the velocity:

  • %

Example

cuando empezó
[Spin the intake before stopping.]
set [IntakeMotorGroup v] velocity to [100] [% v]
spin [IntakeMotorGroup v] [intake v] for [200] [degrees v] ▶

set motor timeout#

The set motor timeout block sets a time limit for how long a Motor block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.

Note: The Motor’s time limit is used to prevent Motor blocks that do not reach their target position from stopping the execution of other blocks in the stack.

set [IntakeMotorGroup v] timeout to [1] seconds

Parameters

Description

motor

The motor group to set:

  • IntakeMotorGroup
  • ArmMotorGroup

time

The maximum number of seconds a Motor block will run before stopping and moving to the next block.

Example

cuando empezó
[Spin the intake before stopping.]
set [IntakeMotorGroup v] timeout to [1] seconds
spin [IntakeMotorGroup v] [intake v] for [5] [turns v] ▶

Position#

motor position#

The motor position block returns the total distance the selected motor or motor group has rotated.

([IntakeMotorGroup v] position in [degrees v])

Parameters

Description

motor

The motor group to return the position of:

  • IntakeMotorGroup
  • ArmMotorGroup

unit

The unit of measurement:

  • degrees
  • turns

set motor position#

The set motor position block sets a specific position value to a motor or motor group, which updates the encoder reading.

set [IntakeMotorGroup v] position to (0) [degrees v]

Parameters

Description

motor

The motor group to set the position of:

  • IntakeMotorGroup
  • ArmMotorGroup

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

Values#

motor is done#

The motor is done? block returns a Boolean indicating whether the motor or motor group is not spinning.

  • True – The motor is not spinning.

  • False – The motor is spinning.

<[IntakeMotorGroup v] is done?>

Parameters

Description

motor

The motor group to check if it isn’t spinning:

  • IntakeMotorGroup
  • ArmMotorGroup

motor is spinning?#

The motor is spinning? block returns a Boolean indicating whether the motor is spinning.

  • True – The motor is spinning.

  • False – The motor is not spinning.

<[IntakeMotorGroup v] is spinning?>

Parameters

Description

motor

The motor group to check if it is spinning:

  • IntakeMotorGroup
  • ArmMotorGroup

motor velocity#

The motor velocity block returns the current rotational speed of the motor or motor group in a range from -100% to 100%.

([IntakeMotorGroup v] velocity in [% v] :: custom-motion)

Parameters

Description

motor

The motor group to return the velocity of:

  • IntakeMotorGroup
  • ArmMotorGroup

unit

The unit that represents the velocity:

  • %

Sensing#

Optical#

Optical found an object?#

The Optical found an object? block returns a Boolean indicating whether the sensor is detecting an object.

  • True – The Optical Sensor is detecting an object.

  • False – The Optical Sensor is not detecting an object.

<[FrontOptical v] found an object?>

Parameters

Description

This block has no parameters.

Optical detects color?#

The Optical detects color? block returns a Boolean indicating whether the sensor is detecting a specified color.

  • True – The Optical Sensor is detecting the specified color.

  • False – The Optical Sensor is not detecting the specified color.

Note: The Optical Sensor is looking for hue ranges that match the specified color. For detecting specific hue ranges, see the Optical hue block.

<[FrontOptical v] detects [red v]?>

Parameters

Description

color

Which color to look for:

  • red
  • green
  • blue
  • white
  • yellow
  • orange
  • purple
  • red violet
  • violet
  • blue violet
  • blue green
  • yellow green
  • yellow orange
  • red orange

Optical brightness#

The Optical brightness block returns the amount of light reflected from the object as a percent.

([FrontOptical v] brightness in %)

Parameters

Description

This block has no parameters.

Optical hue#

The Optical hue block returns the hue value of the detected color.

This value ranges from 0 to 359 degrees, which correlates to the color wheel:

The VEX Color Wheel showing the degrees of colors around a circle, with red at 0 degrees and transitioning through the rainbow as the value increases.

([FrontOptical v] hue in degrees)

Parameters

Description

This block has no parameters.

when Optical#

The when Optical block runs the attached stack whenever the Optical Sensor detects or loses an object.

when [FrontOptical v] [detects v] an object :: hat events

Parameters

Description

state

When the attached stack of blocks will run:

  • detects – An undetected object is now detected
  • loses – A detected object is now no longer detected