Micro:bit krúžok: Rozdiel medzi revíziami
Zo stránky SensorWiki
Vytvorená stránka „'''7. marca 2018''' * Robili sme toto.. <source lang="javascript"> </source>“ |
Bez shrnutí editace |
||
Riadok 2: | Riadok 2: | ||
* Robili sme toto.. | * Robili sme toto.. | ||
Ovládač na Moto:bit | |||
<source lang="javascript"> | <source lang="javascript"> | ||
radio.setGroup(1) | |||
basic.forever(() => { | |||
if (input.buttonIsPressed(Button.AB)) { | |||
radio.sendString("FORWARD") | |||
basic.showLeds(` | |||
. . # . . | |||
. # # # . | |||
# . # . # | |||
. . # . . | |||
. . # . . | |||
`) | |||
} else if (input.buttonIsPressed(Button.B)) { | |||
radio.sendString("LEFT") | |||
basic.showLeds(` | |||
. . # . . | |||
. # . . . | |||
# # # # # | |||
. # . . . | |||
. . # . . | |||
`) | |||
} else if (input.buttonIsPressed(Button.A)) { | |||
radio.sendString("RIGHT") | |||
basic.showLeds(` | |||
. . # . . | |||
. . . # . | |||
. # # # # | |||
. . . # . | |||
. . # . . | |||
`) | |||
} else { | |||
radio.sendString("OFF") | |||
basic.showLeds(` | |||
. # # # . | |||
# # . # # | |||
# . # . # | |||
# # . # # | |||
. # # # . | |||
`) | |||
} | |||
}) | |||
</source> | </source> |
Verzia z 13:40, 7. marec 2018
7. marca 2018
- Robili sme toto..
Ovládač na Moto:bit
radio.setGroup(1)
basic.forever(() => {
if (input.buttonIsPressed(Button.AB)) {
radio.sendString("FORWARD")
basic.showLeds(`
. . # . .
. # # # .
# . # . #
. . # . .
. . # . .
`)
} else if (input.buttonIsPressed(Button.B)) {
radio.sendString("LEFT")
basic.showLeds(`
. . # . .
. # . . .
# # # # #
. # . . .
. . # . .
`)
} else if (input.buttonIsPressed(Button.A)) {
radio.sendString("RIGHT")
basic.showLeds(`
. . # . .
. . . # .
. # # # #
. . . # .
. . # . .
`)
} else {
radio.sendString("OFF")
basic.showLeds(`
. # # # .
# # . # #
# . # . #
# # . # #
. # # # .
`)
}
})