My team wants the robot to turn 90 degrees when button E Up is pressed. We have been unable to find the combination of blocks to accomplish spinning the right motor for a defined amount of rotations on pressing this button once. Can someone please help!
The IQ motors have encoders in them. In modkit and other programs pre-VexCode, we were able to have motors turn without a gyro, so this is possible. However, IQ code overall seems more difficult when programming the controller.
It sounds like what you are telling the robot to do is “spin the right drive motor 90 degrees”. This will not result in the robot turning 90 degrees, unless you just happened to design a robot with exactly the right drivetrain dimensions and layout for that to be true (which is very unlikely).
If you want to turn the robot programmatically, you should configure a drivetrain in VEXcode IQ blocks. Tell the configurator which ports the drive motors are connected to (if you have the motors configured separately, remove them first) and uncheck the “gyro” checkbox to get to this screen:
Enter the right measurements for your robot. If you click the question marks, there are illustrations to show how to measure wheel base and wheel track. If you built the “standard drive base”, “autopilot”, or “clawbot IQ”, or maybe some of the other prebuilds, the default values are already correct, no need to measure anything.
Once you’ve configured a drivetrain, you can use this block:
VEXcode will do the math based on the measurements you entered to figure out how far the drive wheels will have to spin for the robot to turn 90 degrees.
If you have a gyro, leave the box checked and add it to the drivetrain instead of entering the drivetrain measurements. Then VEXcode will use the gyro to measure how far the robot turns and stop at 90 degrees, which will result in more accurate turns.