parent
12b1eb349b
commit
d5194b8d28
BIN
docs/static/tutorials/coast-or-brake.png
vendored
Normal file
BIN
docs/static/tutorials/coast-or-brake.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
docs/static/tutorials/pause-until-pressed.png
vendored
Normal file
BIN
docs/static/tutorials/pause-until-pressed.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
14
docs/tutorials/coast-or-brake.md
Normal file
14
docs/tutorials/coast-or-brake.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Coast Or Brake
|
||||
|
||||
```blocks
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
|
||||
// tell motor to brake once the run command is done
|
||||
motors.largeB.setBrake(true)
|
||||
motors.largeB.run(100, 1, MoveUnit.Rotations)
|
||||
})
|
||||
brick.buttonRight.onEvent(ButtonEvent.Pressed, function () {
|
||||
// tell motor to coast once the run command is done
|
||||
motors.largeB.setBrake(false)
|
||||
motors.largeB.run(100, 1, MoveUnit.Rotations)
|
||||
})
|
||||
```
|
@ -33,6 +33,12 @@
|
||||
"cardType": "example",
|
||||
"url":"/tutorials/tank-zigzag",
|
||||
"imageUrl":"/static/tutorials/tank-zigzag.png"
|
||||
}, {
|
||||
"name": "Coast Or Brake",
|
||||
"description": "Tell motors to coast or brake once the run command is done.",
|
||||
"cardType": "example",
|
||||
"url":"/tutorials/coast-or-brake",
|
||||
"imageUrl":"/static/tutorials/coast-or-brake.png"
|
||||
}]
|
||||
```
|
||||
|
||||
@ -43,3 +49,4 @@
|
||||
[Pivot Turn](/tutorials/pivot-turn),
|
||||
[Smooth Turn](/tutorials/smooth-turn),
|
||||
[Tank ZigZag](/tutorials/tank-zigzag),
|
||||
[Coast Or Brake](/tutorials/coast-or-brake)
|
||||
|
9
docs/tutorials/pause-until-pressed.md
Normal file
9
docs/tutorials/pause-until-pressed.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Pause Until Pressed
|
||||
|
||||
This is an example of code using a touch sensor to detect a wall or other obstacle. The motors are running until the sensor is pressed.
|
||||
|
||||
```blocks
|
||||
motors.largeBC.tank(50, 50)
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
|
||||
motors.largeBC.stop()
|
||||
```
|
@ -10,11 +10,17 @@
|
||||
"url":"/tutorials/touch-to-run",
|
||||
"imageUrl":"/static/tutorials/touch-to-run.png"
|
||||
}, {
|
||||
"name": "Touch Sensor Values",
|
||||
"name": "Sensor Values",
|
||||
"description": "Check the value of a Touch Sensor and stop a motor if pressed.",
|
||||
"cardType": "tutorial",
|
||||
"url":"/tutorials/touch-sensor-values",
|
||||
"imageUrl":"/static/tutorials/touch-sensor-values.png"
|
||||
},
|
||||
"name": "Pause Until Pressed",
|
||||
"description": "Waits for the sensor to be pressed before continuing the program",
|
||||
"cardType": "tutorial",
|
||||
"url":"/tutorials/pause-until-pressed",
|
||||
"imageUrl":"/static/tutorials/pause-until-pressed.png"
|
||||
}]
|
||||
```
|
||||
|
||||
@ -22,3 +28,4 @@
|
||||
|
||||
[Touch to Run](/tutorials/touch-to-run),
|
||||
[Touch Sensor Values](/tutorials/touch-sensor-values),
|
||||
[Pause Until Pressed](/tutorials/pause-until-pressed)
|
Loading…
Reference in New Issue
Block a user