renaming 'set speed' to 'run' (#327)
This commit is contained in:
@ -19,7 +19,7 @@ Reset the motor connected to port **A** and run it for for 2 seconds at a speed
|
||||
```blocks
|
||||
let motorAngle = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(45)
|
||||
motors.largeA.run(45)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
motorAngle = motors.largeA.angle()
|
||||
|
@ -15,11 +15,11 @@ See if the motor turns the same number of times for each of two count periods. R
|
||||
```blocks
|
||||
let tachoCount = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
pause(10000)
|
||||
tachoCount = motors.largeA.tacho()
|
||||
motors.largeA.clearCounts()
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
pause(10000)
|
||||
if (tachoCount == motors.largeA.tacho()) {
|
||||
brick.showString("Motor turns equal.", 1)
|
||||
|
@ -13,12 +13,12 @@ The motor's speed is set back to `0` and the **tacho**, **angle**, and **speed**
|
||||
See what the angle count is when a motor is stopped. Then, try it again after a reset.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
motors.largeA.run(30)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Angle count:", 1)
|
||||
brick.showNumber(motors.largeA.angle(), 2)
|
||||
motors.largeA.setSpeed(30)
|
||||
motors.largeA.run(30)
|
||||
pause(2000)
|
||||
motors.largeA.reset()
|
||||
brick.showString("Angle count:", 4)
|
||||
|
@ -1,9 +1,9 @@
|
||||
# set Speed
|
||||
# run
|
||||
|
||||
Set the rotation speed of the motor as a percentage of maximum speed.
|
||||
|
||||
```sig
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
```
|
||||
|
||||
The speed setting is a pecentage of the motor's full speed. Full speed is the speed that the motor runs when the brick supplies maximum output voltage to the port.
|
||||
@ -19,7 +19,7 @@ If you use a number of milliseconds as movement units, then you don't need to in
|
||||
To run the motor for 500 milliseconds:
|
||||
|
||||
```block
|
||||
motors.largeA.setSpeed(50, 500)
|
||||
motors.largeA.run(50, 500)
|
||||
```
|
||||
|
||||
## ~
|
||||
@ -28,19 +28,19 @@ Here is how you use each different movement unit to run the motor for a fixed ro
|
||||
|
||||
```typescript
|
||||
// Run motor for 700 Milliseconds.
|
||||
motors.largeA.setSpeed(25, 700, MoveUnit.MilliSeconds);
|
||||
motors.largeA.run(25, 700, MoveUnit.MilliSeconds);
|
||||
|
||||
// Run motor for 700 Milliseconds again but no units specified.
|
||||
motors.largeA.setSpeed(25, 700);
|
||||
motors.largeA.run(25, 700);
|
||||
|
||||
// Run the motor for 45 seconds
|
||||
motors.largeA.setSpeed(50, 45, MoveUnit.Seconds);
|
||||
motors.largeA.run(50, 45, MoveUnit.Seconds);
|
||||
|
||||
// Turn the motor for 270 degrees
|
||||
motors.largeA.setSpeed(50, 270, MoveUnit.Degrees)
|
||||
motors.largeA.run(50, 270, MoveUnit.Degrees)
|
||||
|
||||
// Turn the motor at full speed for 9 full rotations
|
||||
motors.largeA.setSpeed(100, 9, MoveUnit.Rotations);
|
||||
motors.largeA.run(100, 9, MoveUnit.Rotations);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@ -56,7 +56,7 @@ motors.largeA.setSpeed(100, 9, MoveUnit.Rotations);
|
||||
Turning the motor in the opposite direction (reverse) is simple. Reverse is just a negative speed setting. To drive the motor in reverse at 25% speed:
|
||||
|
||||
```block
|
||||
motors.largeB.setSpeed(-25)
|
||||
motors.largeB.run(-25)
|
||||
```
|
||||
|
||||
## ~
|
||||
@ -68,7 +68,7 @@ motors.largeB.setSpeed(-25)
|
||||
Run the motor connected to port **A** continuously. Pause 20 seconds and then stop the motor.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(75)
|
||||
motors.largeA.run(75)
|
||||
pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
@ -78,7 +78,7 @@ motors.largeA.stop()
|
||||
Run the motor connected to port **A** in reverse. Pause 5 seconds and then stop the motor.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(-60)
|
||||
motors.largeA.run(-60)
|
||||
pause(5000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
@ -88,7 +88,7 @@ motors.largeA.stop()
|
||||
Run the motor connected to port **B** for 35 full rotations and then stop.
|
||||
|
||||
```blocks
|
||||
motors.largeB.setSpeed(50, 35, MoveUnit.Rotations)
|
||||
motors.largeB.run(50, 35, MoveUnit.Rotations)
|
||||
```
|
||||
|
||||
## See also
|
@ -19,7 +19,7 @@ Also, you can use the brake to do simple skid steering for your brick.
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and set the brake.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
motors.largeA.run(30)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
motors.largeA.setBrake(true)
|
||||
|
@ -17,12 +17,12 @@ You use a positive value (some number greater than `0`) to drive you motor in th
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and switch the direciton of rotation. Run the motor at a speed of `-30`. Watch and see if the motor turns in the same direction as before.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
motors.largeA.run(30)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
pause(2000)
|
||||
motors.largeA.setInverted(true)
|
||||
motors.largeA.setSpeed(-30)
|
||||
motors.largeA.run(-30)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
@ -22,11 +22,11 @@ Turn off the speed regulation for the motor connected to port **A**.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(75)
|
||||
motors.largeA.run(75)
|
||||
pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[set speed](/reference/motors/motor/set-speed), [stop](/reference/motors/motor/stop)
|
||||
[run](/reference/motors/motor/run), [stop](/reference/motors/motor/stop)
|
||||
|
@ -6,7 +6,7 @@ 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.
|
||||
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 point speed when a force, or load, is applied to it.
|
||||
|
||||
## Returns
|
||||
|
||||
@ -18,7 +18,7 @@ Turn speed regulation off and report the actual speed of the large motor in the
|
||||
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(55)
|
||||
motors.largeA.run(55)
|
||||
brick.showString("Actual speed:", 1)
|
||||
for (let i = 0; i < 30; i++) {
|
||||
pause(500)
|
||||
|
@ -13,11 +13,11 @@ The motor stops but any motion caused from previously running the motor continue
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and wait for 2 seconds, then continue at a speed of `50`.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
motors.largeA.run(30)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
pause(2000)
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
@ -33,12 +33,12 @@ A standard way to know how fast a motor is turning is by measuring its _revoluti
|
||||
Run the motor connected to port **A** at half speed for 5 seconds. Display the number of full rotations on the screen.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
pause(5000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Motor rotations:", 1)
|
||||
brick.showNumber(motors.largeA.tacho() / 360, 3)
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeA.run(50)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
Reference in New Issue
Block a user