Output and Pauses

Outputs

On the front of the micro:bit is an 5 by 5 array of LEDs (Light Emitting Diodes). Along with the speaker, the LEDs are the only outputs* on the micro:bit and can be used to display text, numbers and images.

The LEDs can be turned on and off in a number of different ways.


*It is possible to connect more output devices using the input/output interface pins.

Ordinarily each of the outputs will stay on unless another instruction is given to the LEDs.

To turn them off we use the Clear Screen block. This is a basic command, but found under the 'More' menu.

Examples

Press the A button on the micro:bits below to see an example of each output type.

Show String displays a scrolling message

Show Icon displays a preset image or 400ms

Show leds shows a custom designed image for 400ms

Show Number displays a number for 750ms

Pauses

If we want the output to stay on longer than the built in display time, we will need to add a pause before we turn them off.

Pauses are measured in milliseconds (ms).

Example

To make an image stay on the screen for 2 seconds (2000ms) then we need to add a pause of 1600ms (because 'Show Image' already shows the image for 400ms).

Challenge

  • Create a program that when you press the A button has a 3 second countdown, then shows a smiley face for 5 seconds.

Key Words

Output

Computer generated information that a computer can display on screen, print on paper or produce through speakers. Other output could be movement (turning motors off and on).