pxt-calliope/docs/reference/basic/show-leds.md

1.0 KiB

Show LEDs

Display an image on the BBC micro:bit's LED screen.

basic.showLeds(`
    . . . . .
    . # . # .
    . . # . .
    # . . . #
    . # # # .
    `
)

Parameters

  • leds is a String that shows which LEDs are on and off.
  • ms is an optional Number that shows how many milliseconds to wait after showing a picture. If you are programming with blocks, ms starts out as 400 milliseconds.

Example

Open the basic card in the Block Editor and select the show leds blocks.

basic.showLeds(`
    # # . # #
    # # . # #
    . # # # .
    . # . # .
    . # . # .
    `
)

If you are programming in JavaScript, # means an LED that is turned on and . means an LED that is turned off.

Lessons

smiley, flashing heart, magic logo

See also

plot leds, show animation