Flashing Heart
Step 1
Place the ||basic:show leds||
block in the ||basic:on start||
block
and draw a heart.
basic.showLeds(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .`
);
Step 2
Click |Download|
to transfer your code into your micro:bit!
Step 3
Place another ||basic:show leds||
block under the heart to make it blink.
basic.showLeds(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .`);
basic.showLeds(`
. # . # .
# . # . #
# . . . #
. # . # .
. . # . .`);
Step 4
Move the blocks inside the ||basic:forever||
to repeat the animation.
basic.forever(() => {
basic.showLeds(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .`
);
basic.showLeds(`
. # . # .
# . # . #
# . . . #
. # . # .
. . # . .`);
})
Step 5
Click |Download|
to transfer your code in your micro:bit and watch the hearts flash!
Step 6
Place more ||basic:show leds||
blocks to create your own animation.
basic.forever(() => {
basic.showLeds(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .`
);
basic.showLeds(`
. # . # .
# . # . #
# . . . #
. # . # .
. . # . .`);
basic.showLeds(`
. . . . .
. # . # .
. # # # .
. . # . .
. . . . .`);
})
Step 7
Click |Download|
to transfer your code in your micro:bit!