App Lab Documentation

ledScreen.display

Category:micro:bit

Inside of the light array you will use a 1 or 0 in each parameter to turn on or off the LED lights. The array is organized from the 5 Lines of 5 parameters with each light turned on when the block is first used in the code. In order to turn off individual LEDs, replace the 1 with a 0.

Examples

Diamond

Using ledscreen.display(boardArray) creates a diamond shape in the micro:bit board. Think of other shapes you can create using this

ledScreen.display([
([0, 0, 1, 0, 0]),
([0, 1, 1, 1, 0]),
([1, 1, 1, 1, 1]),
([0, 1, 1, 1, 0]),
([0, 0, 1, 0, 0])
]);

Beating Heart

ledscreen.display(boardArray) and two onBoardEvents with the A Button to create a beating heart animation.

onBoardEvent(buttonA, "up", function() {
  ledScreen.display([
  ([0, 1, 0, 1, 0]),
  ([1, 1, 1, 1, 1]),
  ([1, 1, 1, 1, 1]),
  ([0, 1, 1, 1, 0]),
  ([0, 0, 1, 0, 0])
  ]);
});
onBoardEvent(buttonA, "down", function() {
  ledScreen.display([
  ([0, 0, 0, 0, 0]),
  ([0, 1, 0, 1, 0]),
  ([0, 1, 1, 1, 0]),
  ([0, 0, 1, 0, 0]),
  ([0, 0, 0, 0, 0])
  ]);
});

Syntax

ledscreen.display(boardArray)

Parameters

NameTypeRequired?Description
boardArrayArray of Arrays

Use 1s and 0s based inside of the array to turn on and off the LED lights.

Tips

Use 1 to activate the LED light in the array

Use 0 to deactivate the LED light in the array

Found a bug in the documentation? Let us know at support@code.org.