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
|
|
|
|
|
2016-05-20 01:50:02 +02:00
|
|
|
* `leds` is a [String](/reference/types/string) that shows which LEDs are on and off.
|
|
|
|
* `ms` is an optional [Number](/reference/types/number) that shows how many milliseconds to wait after showing a picture.
|
|
|
|
If you are programming with blocks, `ms` starts out as 400 milliseconds.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-05-20 01:50:02 +02:00
|
|
|
### Example
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-05-20 01:50:02 +02:00
|
|
|
Open the `basic` card in the Block Editor and select the `show leds` blocks.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.showLeds(`
|
|
|
|
# # . # #
|
|
|
|
# # . # #
|
|
|
|
. # # # .
|
|
|
|
. # . # .
|
|
|
|
. # . # .
|
|
|
|
`
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
2016-05-20 01:50:02 +02:00
|
|
|
If you are programming in JavaScript, `#` means an LED that is turned on and `.` means an LED that is turned off.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
### 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
|
|
|
|