2018-01-16 06:27:19 +01:00
|
|
|
# Robot Arm
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
function INI() {
|
|
|
|
motors.largeB.setBrake(true)
|
|
|
|
motors.largeC.setBrake(true)
|
|
|
|
motors.mediumA.setBrake(true)
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeB.run(-50)
|
2018-01-16 06:27:19 +01:00
|
|
|
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
|
|
|
|
motors.largeB.stop();
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.mediumA.run(30, 1, MoveUnit.Seconds);
|
|
|
|
motors.mediumA.run(-50, 90, MoveUnit.Degrees);
|
|
|
|
motors.largeC.run(50)
|
2018-01-31 17:28:00 +01:00
|
|
|
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeC.run(-50, 0.86, MoveUnit.Rotations);
|
2018-01-16 06:27:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
INI()
|
|
|
|
|
|
|
|
let down = false;
|
2018-02-15 01:05:31 +01:00
|
|
|
forever(function () {
|
2018-01-16 06:27:19 +01:00
|
|
|
brick.showImage(images.informationQuestionMark)
|
2018-02-07 07:18:39 +01:00
|
|
|
brick.setStatusLight(StatusLight.OrangePulse);
|
2018-01-16 06:27:19 +01:00
|
|
|
pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
|
2018-02-07 07:18:39 +01:00
|
|
|
brick.setStatusLight(StatusLight.Off)
|
2018-01-16 06:27:19 +01:00
|
|
|
music.playSoundEffect(sounds.mechanicalAirRelease)
|
|
|
|
brick.showImage(images.informationAccept)
|
|
|
|
if (down) {
|
|
|
|
brick.showImage(images.informationForward)
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
|
2018-01-16 06:27:19 +01:00
|
|
|
} else {
|
|
|
|
brick.showImage(images.informationBackward)
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeC.run(-65, 0.85, MoveUnit.Rotations);
|
2018-01-16 06:27:19 +01:00
|
|
|
}
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeB.run(20, 275, MoveUnit.Degrees)
|
|
|
|
motors.mediumA.run(30, 1, MoveUnit.Seconds)
|
|
|
|
motors.largeB.run(-55)
|
2018-01-16 06:27:19 +01:00
|
|
|
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
|
|
|
|
motors.largeB.stop();
|
|
|
|
if (down) {
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeC.run(-65, 0.86, MoveUnit.Rotations);
|
2018-01-16 06:27:19 +01:00
|
|
|
} else {
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
|
2018-01-16 06:27:19 +01:00
|
|
|
}
|
2018-02-19 16:35:08 +01:00
|
|
|
motors.largeB.run(20, 275, MoveUnit.Degrees);
|
|
|
|
motors.mediumA.run(-30, 90, MoveUnit.Degrees);
|
|
|
|
motors.largeB.run(-55)
|
2018-01-16 06:27:19 +01:00
|
|
|
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
|
|
|
|
motors.largeB.stop()
|
|
|
|
})
|
|
|
|
```
|