Versuche vier andere Symbole (z.B. Strichmännchen, überraschter Smiley, schlafender Smiley oder Schmetterling) anzuzeigen.
input.onButtonPressed(Button.A, function () {
basic.showIcon(IconNames.Asleep)
})
input.onButtonPressed(Button.B, function () {
basic.showIcon(IconNames.Butterfly)
})
basic.showIcon(IconNames.StickFigure)
basic.forever(function () {
basic.showIcon(IconNames.Surprised)
})input.onButtonPressed(Button.A, function () { basic.showIcon(IconNames.Asleep) }) input.onButtonPressed(Button.B, function () { basic.showIcon(IconNames.Butterfly) }) basic.showIcon(IconNames.StickFigure) basic.forever(function () { basic.showIcon(IconNames.Surprised) })
Versuche einen Geist beim Start mindestens eine Sekunde und einen kleinen Diamanten im Anschluss dauerhaft anzuzeigen.
basic.showIcon(IconNames.Ghost)
basic.pause(1000)
basic.forever(function () {
basic.showIcon(IconNames.SmallDiamond)
})basic.showIcon(IconNames.Ghost) basic.pause(1000) basic.forever(function () { basic.showIcon(IconNames.SmallDiamond) })
Versuche beim Drücken der Taste A einen Text z.B. „Smart“ und Taste B „Feld“ anzuzeigen.
input.onButtonPressed(Button.A, function () {
basic.showString("Smart")
})
input.onButtonPressed(Button.B, function () {
basic.showString("Feld")
})input.onButtonPressed(Button.A, function () { basic.showString("Smart") }) input.onButtonPressed(Button.B, function () { basic.showString("Feld") })
Versuche beim Drücken auf das Micro:bit Logo ein eigenes Symbol anzuzeigen!
input.onLogoEvent(TouchButtonEvent.Pressed, function () {
basic.showLeds(`
# . . . #
. # . # .
. # . # .
. # . # .
. . # . .
`)
})input.onLogoEvent(TouchButtonEvent.Pressed, function () { basic.showLeds(` # . . . # . # . # . . # . # . . # . # . . . # . . `) })
Versuche dauerhaft einen schlafenden Smiley (500ms) gefolgt von einem verwirrten Simley (500ms) anzuzeigen.
basic.forever(function () {
basic.showIcon(IconNames.Asleep)
basic.pause(500)
basic.showIcon(IconNames.Confused)
basic.pause(500)
})basic.forever(function () { basic.showIcon(IconNames.Asleep) basic.pause(500) basic.showIcon(IconNames.Confused) basic.pause(500) })