2017-04-05 19:16:47 +02:00
|
|
|
# Flashing Heart
|
2016-05-28 06:40:59 +02:00
|
|
|
|
2018-10-11 00:38:51 +02:00
|
|
|
## Introduction @unplugged
|
|
|
|
|
2018-12-02 16:58:43 +01:00
|
|
|
Learn how to use the LEDs and make a flashing heart!
|
|
|
|
(Want to learn how lights work? [Watch this video](https://youtu.be/qqBmvHD5bCw)).
|
2018-10-11 00:38:51 +02:00
|
|
|
|
2018-12-02 16:58:43 +01:00
|
|
|
|
|
|
|
![Heart shape in the LEDs](/static/mb/projects/flashing-heart/sim.gif)
|
2018-10-11 00:38:51 +02:00
|
|
|
|
2018-10-10 18:00:56 +02:00
|
|
|
## Step 1 @fullscreen
|
2016-05-28 06:40:59 +02:00
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
Place the ``||basic:show leds||`` block in the ``||basic:forever||`` block and draw a heart.
|
2016-05-28 06:40:59 +02:00
|
|
|
|
2018-10-22 23:14:06 +02:00
|
|
|
![An animation that shows how to drag a block and paint a heart](/static/mb/projects/flashing-heart/showleds.gif)
|
2016-05-28 06:40:59 +02:00
|
|
|
|
2018-10-10 18:00:56 +02:00
|
|
|
## Step 2 @fullscreen
|
2016-05-28 06:40:59 +02:00
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
Place another ``||basic:show leds||`` block. You can leave it blank and draw what you want.
|
2017-04-05 19:16:47 +02:00
|
|
|
|
2017-09-11 19:49:40 +02:00
|
|
|
```blocks
|
2018-10-30 05:36:33 +01:00
|
|
|
basic.forever(function() {
|
2016-12-08 09:10:00 +01:00
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
2018-10-30 05:36:33 +01:00
|
|
|
. . # . .`);
|
2017-04-05 19:16:47 +02:00
|
|
|
basic.showLeds(`
|
2018-10-11 00:38:51 +02:00
|
|
|
. . . . .
|
|
|
|
. . . . .
|
|
|
|
. . . . .
|
|
|
|
. . . . .
|
2018-10-30 05:36:33 +01:00
|
|
|
. . . . .`);
|
2016-06-11 05:09:18 +02:00
|
|
|
})
|
2016-06-11 20:40:09 +02:00
|
|
|
```
|
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
## Step 3 @fullscreen
|
2017-04-05 19:16:47 +02:00
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
Look at the virtual @boardname@, you should see the heart and your drawing blink on the screen.
|
2017-04-05 19:16:47 +02:00
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
![Heart shape in the LEDs](/static/mb/projects/flashing-heart/show-leds.gif)
|
2016-12-08 09:10:00 +01:00
|
|
|
|
2018-10-30 05:36:33 +01:00
|
|
|
## Step 4 @fullscreen
|
2016-12-08 09:10:00 +01:00
|
|
|
|
2018-08-17 16:58:45 +02:00
|
|
|
If you have a @boardname@ connected, click ``|Download|`` to transfer your code and watch the hearts flash!
|