88c58b4e76
* Start of 'motors' topics * Draft the 'motor motion' side doc * Add / update more topics * Last blast of edits * Capture some more edits * Put in movement and steering details
1.1 KiB
1.1 KiB
speed
Get the current speed of motor rotation as a percentage of maximum speed.
motors.largeA.speed()
The actual speed of the motor is the same or very close to it's current speed setting when the motor is regulated. If not regulated, the actual speed can change from the set speed when a force, or load, is applied to it.
Returns
- a number which is the motor's current speed. This value is a percentage of maximum speed from
0
to100
. This number is negative, like-27
, if the direction of rotation is in reverse.
Example
Turn speed regulation off and report the actual speed of the large motor in the forward direction. Occasionally touch the wheel on the motor to see if it changes the speed.
motors.largeA.setRegulated(false)
motors.largeA.setSpeed(55)
brick.showString("Actual speed:", 1)
for (let i = 0; i < 30; i++) {
loops.pause(500)
brick.showNumber(motors.largeA.speed(), 3)
}
motors.largeA.stop()