Skip to main content

Controllers and Loops

VEXcode IQ example project. Beneath the When started block are 4 blocks to Set the Arm motor stopping to hold, set the Claw Motor stopping to hold, set the Arm motor velocity to 60% and the claw motor velocity to 30%. Next is a Forever block with 4 motion blocks inside. In order, they read set left motor velocity to Controller A position %, Set right motor velocity to Controller D position %, spin left motor forward, spin right motor forward.
Clawbot Control example project from VEXcode IQ

Controllers and Loops

In competitions, teams use controllers to wirelessly control their robots. The controller is programmed to update the robot based on input from the user. Loops are used in the project so that the robot repeatedly checks for updated input information. Loops allow the project to rapidly check which buttons have been pressed, or how far joysticks have been pushed. Once checked, this information is quickly relayed to the robot so that it responds quickly to the controller's instructions.

The image above shows the Clawbot Control example project from VEXcode IQ. The forever loop in this project checks the positions of Axes A and D forever in order to set the velocity of the motors.

Loops are important even for autonomous programming without a controller. A loop helps to simplify and organize repeated commands within a project.