Skip to content

Commit

Permalink
renaming 'set speed' to 'run' (microsoft#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Feb 19, 2018
1 parent 3b6cfed commit fad4ca9
Show file tree
Hide file tree
Showing 41 changed files with 177 additions and 177 deletions.
2 changes: 1 addition & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* [set light](/reference/brick/set-status-light)
* [battery level](/reference/brick/battery-level)
* [Motors](/reference/motors)
* [set speed](/reference/motors/motor/set-speed)
* [run](/reference/motors/motor/run)
* [stop](/reference/motors/motor/stop)
* [reset](/reference/motors/motor/reset)
* [set brake](/reference/motors/motor/set-brake)
Expand Down
6 changes: 3 additions & 3 deletions docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ You can program the @boardname@ using [Blocks](/blocks) or [JavaScript](/javascr

```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.setSpeed(50)
motors.largeA.run(50)
})
```
```typescript
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.setSpeed(50)
motors.largeA.run(50)
})
```

Expand All @@ -34,6 +34,6 @@ The simulator has support for the LED screen, buttons, as well as compass, accel

```sim
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.setSpeed(50)
motors.largeA.run(50)
})
```
2 changes: 1 addition & 1 deletion docs/coding/cruise-control-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
```
4 changes: 2 additions & 2 deletions docs/coding/cruise-control-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
```
2 changes: 1 addition & 1 deletion docs/coding/cruise-control-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion docs/coding/reverse-beeper-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
```
2 changes: 1 addition & 1 deletion docs/coding/reverse-beeper-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ forever(function () {
pause(50)
}
})
motors.largeBC.setSpeed(-20);
motors.largeBC.run(-20);
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.stop();
```
2 changes: 1 addition & 1 deletion docs/coding/reverse-beeper-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/coding/reversing-the-robot-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
```
8 changes: 4 additions & 4 deletions docs/coding/reversing-the-robot-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
```
8 changes: 4 additions & 4 deletions docs/coding/reversing-the-robot-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
```
8 changes: 4 additions & 4 deletions docs/coding/roaming-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions docs/coding/roaming-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/core-set/gyroboy-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectNear, function () {
controlSteering = 0
oldControlDrive = controlDrive
controlDrive = -10
motors.mediumC.setSpeed(30, 30, MoveUnit.Degrees);
motors.mediumC.setSpeed(-30, 60, MoveUnit.Degrees);
motors.mediumC.setSpeed(30, 30, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
motors.mediumC.run(-30, 60, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
if (Math.randomRange(-1, 1) >= 1) {
controlSteering = 70
} else {
Expand Down Expand Up @@ -149,8 +149,8 @@ sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {
})
// apply power to motors
function controlMotors() {
motors.largeA.setSpeed(power + controlSteering * 0.1)
motors.largeD.setSpeed(power - controlSteering * 0.1)
motors.largeA.run(power + controlSteering * 0.1)
motors.largeD.run(power - controlSteering * 0.1)
}
sensors.color1.onColorDetected(ColorSensorColor.Yellow, function () {
moods.middleLeft.show()
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/core-set/gyroboy-labview.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ forever(function () {
GM();
EQ();
cntrl();
motors.largeA.setSpeed(lpwr)
motors.largeD.setSpeed(rpwr)
motors.largeA.run(lpwr)
motors.largeD.run(rpwr)
CHK()
let t2 = control.timer1.millis();
let p = 5 - (t2 - t1);
Expand Down Expand Up @@ -196,9 +196,9 @@ forever(function () {
Cstr = 0;
oldDr = Cdrv;
Cdrv = -10;
motors.mediumC.setSpeed(30, 30, MoveUnit.Degrees);
motors.mediumC.setSpeed(-30, 60, MoveUnit.Degrees);
motors.mediumC.setSpeed(30, 30, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
motors.mediumC.run(-30, 60, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
if (Math.randomRange(-1, 1) >= 1)
Cstr = 70;
else
Expand Down
34 changes: 17 additions & 17 deletions docs/examples/core-set/puppy-labview.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function MNRH() {
brick.setStatusLight(StatusLight.OrangePulse)
while (!brick.buttonEnter.wasPressed()) {
if (brick.buttonUp.wasPressed()) {
motors.mediumC.setSpeed(-100);
motors.mediumC.run(-100);
} else if (brick.buttonDown.wasPressed()) {
motors.mediumC.setSpeed(100);
motors.mediumC.run(100);
} else {
motors.mediumC.stop();
}
Expand Down Expand Up @@ -83,20 +83,20 @@ function UP() {
if (motors.largeA.angle() > -50) {
control.runInParallel(function () {
motors.largeD.clearCounts()
motors.largeD.setSpeed(-35);
motors.largeD.run(-35);
pauseUntil(() => motors.largeD.angle() < -25);
motors.largeD.stop();
motors.largeD.setRegulated(false)
motors.largeD.setSpeed(-15)
motors.largeD.run(-15)
pauseUntil(() => motors.largeD.angle() < -65);
motors.largeD.stop();
})
motors.largeA.clearCounts()
motors.largeA.setSpeed(-35);
motors.largeA.run(-35);
pauseUntil(() => motors.largeA.angle() < -25);
motors.largeA.stop();
motors.largeA.setRegulated(false)
motors.largeA.setSpeed(-15)
motors.largeA.run(-15)
pauseUntil(() => motors.largeA.angle() < -65);
motors.largeA.stop();

Expand Down Expand Up @@ -231,9 +231,9 @@ function IDL() {
function MHT(Pos: number) {
let _R = Pos - motors.mediumC.angle();
if (_R >= 0) {
motors.mediumC.setSpeed(100, _R, MoveUnit.Degrees);
motors.mediumC.run(100, _R, MoveUnit.Degrees);
} else {
motors.mediumC.setSpeed(-100, Math.abs(_R), MoveUnit.Degrees);
motors.mediumC.run(-100, Math.abs(_R), MoveUnit.Degrees);
}
}

Expand Down Expand Up @@ -304,28 +304,28 @@ function PPP() {
IS(2);
UP();
pause(100)
motors.largeA.setSpeed(-30, 70, MoveUnit.Degrees);
motors.largeA.run(-30, 70, MoveUnit.Degrees);
pause(800);
music.playSoundEffect(sounds.mechanicalHorn1);
pause(1000);
for(let i = 0; i < 3; ++i) {
motors.largeA.setSpeed(-30, 20, MoveUnit.Degrees);
motors.largeA.setSpeed(30, 20, MoveUnit.Degrees);
motors.largeA.run(-30, 20, MoveUnit.Degrees);
motors.largeA.run(30, 20, MoveUnit.Degrees);
}
motors.largeA.setSpeed(30, 70, MoveUnit.Degrees);
motors.largeA.run(30, 70, MoveUnit.Degrees);
F_C = 1;
CS(0);
}

function HPY() {
IS(8)
MHT(0);
motors.largeAD.setSpeed(10, 0.8, MoveUnit.Seconds);
motors.largeAD.run(10, 0.8, MoveUnit.Seconds);
for(let i = 0; i < 3; ++i) {
music.playSoundEffect(sounds.animalsDogBark1);
motors.largeAD.setSpeed(-100, 0.2, MoveUnit.Seconds);
motors.largeAD.run(-100, 0.2, MoveUnit.Seconds);
pause(300)
motors.largeAD.setSpeed(10, 0.3, MoveUnit.Seconds)
motors.largeAD.run(10, 0.3, MoveUnit.Seconds)
}
pause(500);
music.stopAllSounds();
Expand All @@ -335,9 +335,9 @@ function HPY() {

function STL() {
UP();
motors.largeAD.setSpeed(-20, 60, MoveUnit.Degrees);
motors.largeAD.run(-20, 60, MoveUnit.Degrees);
music.playSoundEffect(sounds.animalsDogWhine);
motors.largeAD.setSpeed(20, 60, MoveUnit.Degrees);
motors.largeAD.run(20, 60, MoveUnit.Degrees);
}

function WKU() {
Expand Down
30 changes: 15 additions & 15 deletions docs/examples/core-set/robotarm-labview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ function INI() {
motors.largeB.setBrake(true)
motors.largeC.setBrake(true)
motors.mediumA.setBrake(true)
motors.largeB.setSpeed(-50)
motors.largeB.run(-50)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
motors.mediumA.setSpeed(30, 1, MoveUnit.Seconds);
motors.mediumA.setSpeed(-50, 90, MoveUnit.Degrees);
motors.largeC.setSpeed(50)
motors.mediumA.run(30, 1, MoveUnit.Seconds);
motors.mediumA.run(-50, 90, MoveUnit.Degrees);
motors.largeC.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
motors.largeC.setSpeed(-50, 0.86, MoveUnit.Rotations);
motors.largeC.run(-50, 0.86, MoveUnit.Rotations);
}

INI()
Expand All @@ -27,24 +27,24 @@ forever(function () {
brick.showImage(images.informationAccept)
if (down) {
brick.showImage(images.informationForward)
motors.largeC.setSpeed(65, 0.85, MoveUnit.Rotations);
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
} else {
brick.showImage(images.informationBackward)
motors.largeC.setSpeed(-65, 0.85, MoveUnit.Rotations);
motors.largeC.run(-65, 0.85, MoveUnit.Rotations);
}
motors.largeB.setSpeed(20, 275, MoveUnit.Degrees)
motors.mediumA.setSpeed(30, 1, MoveUnit.Seconds)
motors.largeB.setSpeed(-55)
motors.largeB.run(20, 275, MoveUnit.Degrees)
motors.mediumA.run(30, 1, MoveUnit.Seconds)
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
if (down) {
motors.largeC.setSpeed(-65, 0.86, MoveUnit.Rotations);
motors.largeC.run(-65, 0.86, MoveUnit.Rotations);
} else {
motors.largeC.setSpeed(65, 0.85, MoveUnit.Rotations);
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
}
motors.largeB.setSpeed(20, 275, MoveUnit.Degrees);
motors.mediumA.setSpeed(-30, 90, MoveUnit.Degrees);
motors.largeB.setSpeed(-55)
motors.largeB.run(20, 275, MoveUnit.Degrees);
motors.mediumA.run(-30, 90, MoveUnit.Degrees);
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop()
})
Expand Down
Loading

0 comments on commit fad4ca9

Please sign in to comment.