2016-06-11 05:09:18 +02:00
|
|
|
![](/static/mb/projects/a1-display.png)
|
|
|
|
|
|
|
|
Use the LEDs to display a flashing heart.
|
2016-05-28 06:40:59 +02:00
|
|
|
|
|
|
|
## Step 1
|
|
|
|
|
|
|
|
Use [show leds](/reference/basic/showLeds) and make your code look like this:
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
```
|
|
|
|
|
|
|
|
## Step 2
|
|
|
|
|
|
|
|
Add a [pause](/reference/basic/pause) to wait and [clear screen](/reference/basic/clearScreen) to turn off the LEDs.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.clearScreen();
|
2016-06-11 05:09:18 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Step 3
|
|
|
|
|
|
|
|
Put a [forever loop](/reference/basic/forever) around it.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
2016-06-12 04:15:36 +02:00
|
|
|
# # # # #d
|
2016-06-11 05:09:18 +02:00
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.clearScreen();
|
|
|
|
})
|
2016-06-11 20:40:09 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Step 4
|
|
|
|
|
|
|
|
Add a [pause](/reference/basic/pause) to wait after clearing the screen.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.clearScreen();
|
|
|
|
basic.pause(500);
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
## Step 5
|
|
|
|
|
|
|
|
Add a second image of a broken heart.
|
|
|
|
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# # # # #
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.clearScreen();
|
|
|
|
basic.pause(500);
|
|
|
|
basic.showLeds(`
|
|
|
|
. # . # .
|
|
|
|
# . # # #
|
|
|
|
# . . . #
|
|
|
|
. # # # .
|
|
|
|
. . # . .`);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.clearScreen();
|
|
|
|
basic.pause(500);
|
|
|
|
})
|
2016-05-28 06:40:59 +02:00
|
|
|
```
|