How do you set a motor named 'leftMotor' to move at full forward speed?

Enhance your programming skills with the RECF Programming Test. Features flashcards and multiple choice questions with hints and explanations. Prepare for success!

Multiple Choice

How do you set a motor named 'leftMotor' to move at full forward speed?

Explanation:
Setting a motor’s speed is done by writing to the motor control array and using the motor’s symbolic name as the index, with a speed value in the valid range (negative for reverse, positive for forward). The speed 127 represents full forward, so targeting the specific motor with the exact name leftMotor and assigning 127 sets that motor to full forward. That is why motor[leftMotor] = 127 is the right choice. The other forms fail because they either try to assign to a plain variable rather than the motor control array, use an undefined or case-mifferent identifier, or call a function not used in this motor-control style.

Setting a motor’s speed is done by writing to the motor control array and using the motor’s symbolic name as the index, with a speed value in the valid range (negative for reverse, positive for forward). The speed 127 represents full forward, so targeting the specific motor with the exact name leftMotor and assigning 127 sets that motor to full forward. That is why motor[leftMotor] = 127 is the right choice. The other forms fail because they either try to assign to a plain variable rather than the motor control array, use an undefined or case-mifferent identifier, or call a function not used in this motor-control style.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy