pxt-ev3/docs/examples/crane-labview.md
Peli de Halleux ea956f1a73
Buttons rename (#287)
* renaming up/down/click to released/pressed/bump

* missing images

* fixing signature issue

* updated strings

* white lego logo
2018-01-31 08:28:00 -08:00

1.8 KiB

Crane LabView

function INI() {
    motors.largeB.setBrake(true)
    motors.largeC.setBrake(true)
    motors.mediumA.setBrake(true)
    motors.largeB.setSpeed(-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)
    sensors.touch1.pauseUntil(ButtonEvent.Pressed);
    motors.largeC.setSpeed(-50, 0.86, MoveUnit.Rotations);
}

INI()

let down = false;
loops.forever(function () {
    brick.showImage(images.informationQuestionMark)
    brick.setLight(BrickLight.OrangePulse);
    pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
    brick.setLight(BrickLight.Off)
    music.playSoundEffect(sounds.mechanicalAirRelease)
    brick.showImage(images.informationAccept)
    if (down) {
        brick.showImage(images.informationForward)
        motors.largeC.setSpeed(65, 0.85, MoveUnit.Rotations);
    } else {
        brick.showImage(images.informationBackward)
        motors.largeC.setSpeed(-65, 0.85, MoveUnit.Rotations);
    }
    motors.largeB.setSpeed(20, 275, MoveUnit.Degrees)
    motors.mediumA.setSpeed(30, 1, MoveUnit.Seconds)
    motors.largeB.setSpeed(-55)
    pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
    motors.largeB.stop();
    if (down) {
        motors.largeC.setSpeed(-65, 0.86, MoveUnit.Rotations);
    } else {
        motors.largeC.setSpeed(65, 0.85, MoveUnit.Rotations);
    }
    motors.largeB.setSpeed(20, 275, MoveUnit.Degrees);
    motors.mediumA.setSpeed(-30, 90, MoveUnit.Degrees);
    motors.largeB.setSpeed(-55)
    pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
    motors.largeB.stop()
})