Skip to main content

Roll It Red

Use [Drive for] and [Turn for] blocks to drive the Hero Bot to a Roller, and use the Optical Sensor and the intake motor group to detect the Roller and spin it to red. 

  • Select the VRC Virtual Skills - Spin Up Playground.
  • Drive the Hero Bot toward a Roller.
  • When the Optical Sensor detects the Roller, drive the Hero Bot closer to make contact.
  • Code the robot to spin the intake motor group to spin the Roller.
  • When the Optical Sensor detects red after detecting blue, stop rolling the Roller.

Helpful Hints

  • Use the RollerOptical sensing block from the Sensing category to detect a Roller close to the Hero Bot.

    VEXcode Distance found an object block that reads 'RollerOptical found an object?'.

    • Matching Python command:

      roller_optical.is_near_object()
  • Use the RollerOptical sensing block from the Sensing category to detect the color.

    VEXcode Optical detects color block that reads 'RollerOptical detects red?'.

    • Matching Python command:

      roller_optical.color() == Color.RED
  • Use the spin IntakeMotorGroup block from the Motion category and select the outtake direction to spin the Roller.

    VEXcode Spin block that reads 'spin IntakeMotorGroup outtake'.

    • Matching Python command:

      intake_motor_group.spin(FORWARD)
  • Use the stop IntakeMotorGroup block from the Motion category to stop spinning the Roller.

    VEXcode Stop motor block that reads 'stop IntakeMotorGroup'.

    • Matching Python command:

      intake_motor_group.stop()

For more information about the robot features in VRC Virtual Skills, please see this article.