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.
Matching Python command:
roller_optical.is_near_object()
Use the RollerOptical sensing block from the Sensing category to detect the color.
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.
Matching Python command:
intake_motor_group.spin(FORWARD)
Use the stop IntakeMotorGroup block from the Motion category to stop spinning the Roller.
Matching Python command:
intake_motor_group.stop()
For more information about the robot features in VRC Virtual Skills, please see this article.