Press button tutorial (#416)
* Add tutorial for 'Make Animation' * Finish off the tutorial
This commit is contained in:
parent
60bf3df1d8
commit
0bb7295d86
BIN
docs/static/tutorials/make-an-animation.png
vendored
Normal file
BIN
docs/static/tutorials/make-an-animation.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
docs/static/tutorials/make-an-animation/button-pressed.gif
vendored
Normal file
BIN
docs/static/tutorials/make-an-animation/button-pressed.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
@ -11,5 +11,11 @@ Step by step guide to coding your @boardname@.
|
|||||||
"cardType": "tutorial",
|
"cardType": "tutorial",
|
||||||
"url":"/tutorials/wake-up",
|
"url":"/tutorials/wake-up",
|
||||||
"imageUrl":"/static/tutorials/wake-up.png"
|
"imageUrl":"/static/tutorials/wake-up.png"
|
||||||
|
}, {
|
||||||
|
"name": "Make An Animation",
|
||||||
|
"description": "Create a custom animation for your LEGO Mindstorms Brick.",
|
||||||
|
"cardType": "tutorial",
|
||||||
|
"url":"/tutorials/make-an-animation",
|
||||||
|
"imageUrl":"/static/tutorials/make-an-animation.png"
|
||||||
}]
|
}]
|
||||||
```
|
```
|
@ -1 +0,0 @@
|
|||||||
# Brick Screen
|
|
61
docs/tutorials/make-an-animation.md
Normal file
61
docs/tutorials/make-an-animation.md
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Make a custom animation
|
||||||
|
|
||||||
|
## Introduction @fullscreen
|
||||||
|
|
||||||
|
Create a custom animation for your LEGO Mindstorms Brick.
|
||||||
|
|
||||||
|
![Button press on brick](/static/tutorials/make-an-animation/button-pressed.gif)
|
||||||
|
|
||||||
|
## Step 1
|
||||||
|
|
||||||
|
Open the ``||brick:Brick||`` Toolbox drawer. Drag out a ``||brick:show string||`` block onto the Workspace, and drop it into the ``||loops:on Start||`` block. You should hear and see the block click into place.
|
||||||
|
|
||||||
|
```block
|
||||||
|
brick.showString("Hello world", 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 2
|
||||||
|
|
||||||
|
In the ``||brick:show string||`` block, type the text ``"Press my button"`` to replace ``"Hello world"``.
|
||||||
|
|
||||||
|
```block
|
||||||
|
brick.showString("Press my button!", 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 3
|
||||||
|
|
||||||
|
Open the ``||brick:Brick||`` Toolbox drawer. Drag out an ``||brick:on button||`` block onto anyplace in the Workspace.
|
||||||
|
|
||||||
|
```block
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||||
|
|
||||||
|
})
|
||||||
|
brick.showString("Press my button!", 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 4
|
||||||
|
|
||||||
|
Open the ``||brick:Brick||`` Toolbox drawer. Drag out a ``||brick:show image||`` block onto the Workspace, and drop it into the ``||brick:on button||`` block.
|
||||||
|
|
||||||
|
```block
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||||
|
brick.showImage(images.expressionsBigSmile)
|
||||||
|
})
|
||||||
|
brick.showString("Press my button!", 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 5
|
||||||
|
|
||||||
|
Open the ``||brick:Brick||`` Toolbox drawer. Drag out a ``||brick:set status light||`` block onto the Workspace, and drop it into the ``||brick:on button||`` block after the ``||brick:show image||`` block.
|
||||||
|
|
||||||
|
```block
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||||
|
brick.showImage(images.expressionsBigSmile)
|
||||||
|
brick.setStatusLight(StatusLight.Orange)
|
||||||
|
})
|
||||||
|
brick.showString("Press my button!", 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 6
|
||||||
|
|
||||||
|
Now, let’s download our program to the brick. Plug your EV3 brick into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick.
|
Loading…
Reference in New Issue
Block a user