Operácie

Micro:bit krúžok

Z SensorWiki

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(`
            . # # # .
            # # . # #
            # . # . #
            # # . # #
            . # # # .
            `)
    }
})