renaming 'set speed' to 'run' (#327)

This commit is contained in:
Peli de Halleux
2018-02-19 07:35:08 -08:00
committed by GitHub
parent 3b6cfed5b2
commit fad4ca98db
41 changed files with 177 additions and 177 deletions

View File

@ -5,6 +5,6 @@ let speed = 0;
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
if (speed < 100)
speed = speed + 10;
motors.largeBC.setSpeed(speed);
motors.largeBC.run(speed);
})
```

View File

@ -5,11 +5,11 @@ let speed = 0;
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
if (speed < 100)
speed = speed + 10;
motors.largeBC.setSpeed(speed);
motors.largeBC.run(speed);
})
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
if (speed > -100)
speed = speed - 10;
motors.largeBC.setSpeed(speed);
motors.largeBC.run(speed);
})
```

View File

@ -15,7 +15,7 @@ function accelerate() {
function update() {
brick.clearScreen()
brick.showString("speed: " + speed, 1)
motors.largeBC.setSpeed(speed)
motors.largeBC.run(speed)
}
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
accelerate()

View File

@ -5,7 +5,7 @@ forever(function () {
music.playTone(440, sensors.ultrasonic4.distance());
pause(50)
})
motors.largeBC.setSpeed(-20);
motors.largeBC.run(-20);
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.stop();
```

View File

@ -7,7 +7,7 @@ forever(function () {
pause(50)
}
})
motors.largeBC.setSpeed(-20);
motors.largeBC.run(-20);
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.stop();
```

View File

@ -4,7 +4,7 @@
let beep = false
beep = true
control.runInParallel(function () {
motors.largeBC.setSpeed(-20)
motors.largeBC.run(-20)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
motors.largeBC.stop()
beep = false

View File

@ -2,13 +2,13 @@
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.setSpeed(50)
motors.largeBC.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
motors.largeBC.setSpeed(-50)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
})
```

View File

@ -3,13 +3,13 @@
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.setSpeed(50)
motors.largeBC.run(50)
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
motors.largeBC.setSpeed(-50)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
})
```

View File

@ -5,15 +5,15 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
brick.showImage(images.eyesSleeping)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
brick.showImage(images.eyesNeutral)
motors.largeBC.setSpeed(50)
motors.largeBC.run(50)
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
brick.showImage(images.eyesTiredMiddle)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
brick.showImage(images.eyesDizzy)
motors.largeBC.setSpeed(-50)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.setSpeed(0)
motors.largeBC.run(0)
})
```

View File

@ -19,13 +19,13 @@ pause(1000)
music.playSoundEffectUntilDone(sounds.communicationGo)
for (let d of drive) {
if (d == 1) {
motors.largeC.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeC.run(50, 360, MoveUnit.Degrees)
} else if (d == 3) {
motors.largeB.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeB.run(50, 360, MoveUnit.Degrees)
} else if (d == 4) {
motors.largeBC.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeBC.run(50, 360, MoveUnit.Degrees)
} else {
motors.largeBC.setSpeed(-50, 360, MoveUnit.Degrees)
motors.largeBC.run(-50, 360, MoveUnit.Degrees)
}
}
music.playSoundEffectUntilDone(sounds.communicationGameOver)

View File

@ -23,13 +23,13 @@ pause(1000)
music.playSoundEffectUntilDone(sounds.communicationGo)
for (let d of drive) {
if (d == 1) {
motors.largeC.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeC.run(50, 360, MoveUnit.Degrees)
} else if (d == 3) {
motors.largeB.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeB.run(50, 360, MoveUnit.Degrees)
} else if (d == 4) {
motors.largeBC.setSpeed(50, 360, MoveUnit.Degrees)
motors.largeBC.run(50, 360, MoveUnit.Degrees)
} else {
motors.largeBC.setSpeed(-50, 360, MoveUnit.Degrees)
motors.largeBC.run(-50, 360, MoveUnit.Degrees)
}
}
music.playSoundEffectUntilDone(sounds.communicationGameOver)