replacing loops.pause -> pause, loops.forever -> forever
This commit is contained in:
@ -16,7 +16,7 @@ Show the battery level percentage on the screen. Also, show a green light if the
|
||||
|
||||
```blocks
|
||||
let battery = 0;
|
||||
loops.forever(function() {
|
||||
forever(function() {
|
||||
brick.showString("Battery level:", 1)
|
||||
brick.showNumber(battery, 2)
|
||||
battery = brick.batteryLevel();
|
||||
@ -28,6 +28,6 @@ loops.forever(function() {
|
||||
} else {
|
||||
brick.setStatusLight(StatusLight.RedPulse)
|
||||
}
|
||||
loops.pause(30000)
|
||||
pause(30000)
|
||||
})
|
||||
```
|
@ -32,7 +32,7 @@ Set the brick light to green when the `down` is pressed. When the button is not
|
||||
|
||||
```blocks
|
||||
let isRed = false;
|
||||
loops.forever(function() {
|
||||
forever(function() {
|
||||
if (brick.buttonLeft.isPressed()) {
|
||||
brick.setStatusLight(StatusLight.Green);
|
||||
isRed = false;
|
||||
|
@ -16,7 +16,7 @@ brick.showString("self-destruct in:", 2);
|
||||
brick.showString("seconds", 5);
|
||||
for (let i = 0; i < 10; i++) {
|
||||
brick.showNumber(10 - i, 4);
|
||||
loops.pause(1000);
|
||||
pause(1000);
|
||||
}
|
||||
brick.clearScreen();
|
||||
```
|
||||
|
@ -24,14 +24,14 @@ brick.setStatusLight(StatusLight.Red);
|
||||
Repeatedly show a different color pattern for the brick light.
|
||||
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
forever(function () {
|
||||
brick.setStatusLight(StatusLight.Orange)
|
||||
loops.pause(1000)
|
||||
pause(1000)
|
||||
brick.setStatusLight(StatusLight.GreenFlash)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
brick.setStatusLight(StatusLight.RedPulse)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
brick.setStatusLight(StatusLight.Off)
|
||||
loops.pause(500)
|
||||
pause(500)
|
||||
})
|
||||
```
|
||||
|
@ -20,7 +20,7 @@ Reset the motor connected to port **A** and run it for for 2 seconds at a speed
|
||||
let motorAngle = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(45)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
motorAngle = motors.largeA.angle()
|
||||
```
|
||||
|
@ -16,11 +16,11 @@ See if the motor turns the same number of times for each of two count periods. R
|
||||
let tachoCount = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(10000)
|
||||
pause(10000)
|
||||
tachoCount = motors.largeA.tacho()
|
||||
motors.largeA.clearCounts()
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(10000)
|
||||
pause(10000)
|
||||
if (tachoCount == motors.largeA.tacho()) {
|
||||
brick.showString("Motor turns equal.", 1)
|
||||
} else {
|
||||
|
@ -14,12 +14,12 @@ See what the angle count is when a motor is stopped. Then, try it again after a
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Angle count:", 1)
|
||||
brick.showNumber(motors.largeA.angle(), 2)
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.reset()
|
||||
brick.showString("Angle count:", 4)
|
||||
brick.showNumber(motors.largeA.angle(), 5)
|
||||
|
@ -20,7 +20,7 @@ Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
motors.largeA.setBrake(true)
|
||||
```
|
||||
|
@ -18,12 +18,12 @@ Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.setInverted(true)
|
||||
motors.largeA.setSpeed(-30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
|
@ -23,7 +23,7 @@ Turn off the speed regulation for the motor connected to port **A**.
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(75)
|
||||
loops.pause(20000)
|
||||
pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
|
@ -69,7 +69,7 @@ Run the motor connected to port **A** continuously. Pause 20 seconds and then st
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(75)
|
||||
loops.pause(20000)
|
||||
pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
@ -79,7 +79,7 @@ Run the motor connected to port **A** in reverse. Pause 5 seconds and then stop
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(-60)
|
||||
loops.pause(5000)
|
||||
pause(5000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
|
@ -21,7 +21,7 @@ motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(55)
|
||||
brick.showString("Actual speed:", 1)
|
||||
for (let i = 0; i < 30; i++) {
|
||||
loops.pause(500)
|
||||
pause(500)
|
||||
brick.showNumber(motors.largeA.speed(), 3)
|
||||
}
|
||||
motors.largeA.stop()
|
||||
|
@ -14,9 +14,9 @@ Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.stop()
|
||||
loops.pause(2000)
|
||||
pause(2000)
|
||||
motors.largeA.setSpeed(50)
|
||||
```
|
||||
|
||||
|
@ -34,7 +34,7 @@ Run the motor connected to port **A** at half speed for 5 seconds. Display the n
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(5000)
|
||||
pause(5000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Motor rotations:", 1)
|
||||
brick.showNumber(motors.largeA.tacho() / 360, 3)
|
||||
|
@ -14,7 +14,7 @@ Tank the @boardname@ forward at half speed for 5 seconds and then stop.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(50, 50);
|
||||
loops.pause(5000);
|
||||
pause(5000);
|
||||
motors.stopAll();
|
||||
```
|
||||
|
||||
|
@ -72,9 +72,9 @@ Steer the brick in a snake pattern for a short time.
|
||||
```block
|
||||
for (let i = 0; i < 4; i++) {
|
||||
motors.largeBC.steer(30, 30)
|
||||
loops.pause(5000)
|
||||
pause(5000)
|
||||
motors.largeBC.steer(-30, 30)
|
||||
loops.pause(5000)
|
||||
pause(5000)
|
||||
}
|
||||
motors.stopAll()
|
||||
```
|
||||
|
@ -43,9 +43,9 @@ Move the brick straight ahead and then go backward.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(75, 75)
|
||||
loops.pause(10000)
|
||||
pause(10000)
|
||||
motors.largeAB.tank(-55, -55)
|
||||
loops.pause(10000)
|
||||
pause(10000)
|
||||
motors.stopAll()
|
||||
```
|
||||
|
||||
@ -72,7 +72,7 @@ Run both motors in opposite directions to spin the brick around to the left.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(-30, 30)
|
||||
loops.pause(5000)
|
||||
pause(5000)
|
||||
motors.stopAll()
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user