f4aa25e2bd
* Modify tutorials for single dl step * Some more fixes * coin flip typer
89 lines
1.5 KiB
Markdown
89 lines
1.5 KiB
Markdown
# Flashing Heart
|
|
|
|
## Step 1
|
|
|
|
Place the ``||basic:show leds||`` block in the ``||basic:on start||`` block and draw a heart.
|
|
|
|
```blocks
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# # # # #
|
|
# # # # #
|
|
. # # # .
|
|
. . # . .`
|
|
);
|
|
```
|
|
|
|
## Step 2
|
|
|
|
Place another ``||basic:show leds||`` block under the heart to make it blink. Check in the simulator to see the heart blink.
|
|
|
|
```blocks
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# # # # #
|
|
# # # # #
|
|
. # # # .
|
|
. . # . .`);
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# . # . #
|
|
# . . . #
|
|
. # . # .
|
|
. . # . .`);
|
|
```
|
|
|
|
## Step 3
|
|
|
|
Move the blocks inside the ``||basic:forever||`` to repeat the animation.
|
|
|
|
```blocks
|
|
basic.forever(() => {
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# # # # #
|
|
# # # # #
|
|
. # # # .
|
|
. . # . .`
|
|
);
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# . # . #
|
|
# . . . #
|
|
. # . # .
|
|
. . # . .`);
|
|
})
|
|
```
|
|
|
|
## Step 4
|
|
|
|
Place more ``||basic:show leds||`` blocks to create your own animation.
|
|
|
|
```blocks
|
|
basic.forever(() => {
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# # # # #
|
|
# # # # #
|
|
. # # # .
|
|
. . # . .`
|
|
);
|
|
basic.showLeds(`
|
|
. # . # .
|
|
# . # . #
|
|
# . . . #
|
|
. # . # .
|
|
. . # . .`);
|
|
basic.showLeds(`
|
|
. . . . .
|
|
. # . # .
|
|
. # # # .
|
|
. . # . .
|
|
. . . . .`);
|
|
})
|
|
```
|
|
|
|
## Step 5
|
|
|
|
If you have a @boardname@ connected, click ``|Download|`` to transfer your code and watch the hearts flash!
|