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?

Here is the error:

EDIT: I added more and only half of them had the 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?

Here is the error:

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

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