Code error?

My code has this error popping up, even though it is the exact same as the one above it. (circled in blue) What could be the issue?
Screenshot 2022-11-07 5.16.53 PM
Here is the error:
image

EDIT: I added more and only half of them had the error.
image

You’re asking the motor to “spin 4 inches” which is not something it knows how to do – you can instead give it an amount to spin in degrees or turns (i.e. rotations).

3 Likes

Ohh I see. How many rotations is an inch?

Assuming these are drivetrain motors – if the drive wheels turn 1 rotation, the robot will move forward by the wheel circumference.

(VEXcode’s built-in drivetrain object does the math to figure this out for you, which is why you have to specify your wheel size when setting up the drivetrain)

4 Likes

Oh okay. So if I use 4" wheels, then one rotation will be 4 inches?

The VEX 4" wheels are 4 inches in diameter, to get the circumference you would need to multiply the diameter by pi.

4 Likes

Right okay. So the circumference is ~12 inches. If one rotation is the circumference (12 inches) then if I divide the distance I want to go (4 inches) by the circumference then I would get 0.3. So 0.3 of a rotation. Do I have it right?

That’s correct!

Although you will probably want a more precise value for the wheel circumference than “12 inches” – the actual value is about 12.57 and that error will add up to something meaningful if you want the robot to travel more than a few inches.

5 Likes

Amazing! Thank you so much for your help!

1 Like