2016-03-26 00:47:20 +01:00
|
|
|
# Show LEDs
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
Display an image on the BBC micro:bit's [LED screen](/device/screen).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
basic.showLeds(`
|
|
|
|
. . . . .
|
|
|
|
. # . # .
|
|
|
|
. . # . .
|
|
|
|
# . . . #
|
|
|
|
. # # # .
|
|
|
|
`
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
* ``leds`` - a series of LED on/off states that form an image (see steps below)
|
2016-04-13 17:27:45 +02:00
|
|
|
* (optional) ``ms`` - [Number](/reference/types/number) - time to wait after displaying image. In blocks, ``ms`` is 400 by default.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
### Example - Block Editor
|
|
|
|
|
|
|
|
1. Open the `basic` category and select the `show leds` blocks.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.showLeds(`
|
|
|
|
# # . # #
|
|
|
|
# # . # #
|
|
|
|
. # # # .
|
|
|
|
. # . # .
|
|
|
|
. # . # .
|
|
|
|
`
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
In JavaScript, the led off is represented by a `.` and the led on by a `#` character.
|
|
|
|
|
|
|
|
### Lessons
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
[smiley](/lessons/smiley), [flashing heart](/lessons/flashing-heart), [magic logo](/lessons/magic-logo)
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
### See also
|
|
|
|
|
2016-04-16 01:15:08 +02:00
|
|
|
[plot leds](/reference/led/plot-leds), [show animation](/reference/basic/show-animation)
|
2016-03-26 00:47:20 +01:00
|
|
|
|