Overview

This Micro:Bit program displays a symbol(rock, paper, scissor) based on which input buttons were pressed.

Code

input.onButtonPressed(Button.AB, function () {
})
basic.showString("Shoot!")
basic.pause(1000)
if (input.buttonIsPressed(Button.AB)) {
basic.showLeds(`
# # . . #
# # . # .
. . # . .
# # . # .
# # . . #
`)
} else if (input.buttonIsPressed(Button.B)) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (input.buttonIsPressed(Button.A)) {
basic.showLeds(`
. . . . .
. # # # .
. # . # .
. # # # .
. . . . .
`)
} else {
basic.showLeds(`
. . . . .
# # # # #
# # # . .
. # . . .
. # . . .
`)
}