renaming 'set speed' to 'run' (#327)
This commit is contained in:
@ -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 {
|
||||
@ -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()
|
||||
|
@ -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);
|
||||
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,15 +304,15 @@ 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);
|
||||
}
|
||||
@ -320,12 +320,12 @@ function PPP() {
|
||||
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();
|
||||
@ -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() {
|
||||
|
@ -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()
|
||||
@ -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()
|
||||
})
|
||||
|
Reference in New Issue
Block a user