Operácie

Micro:bit krúžok: Rozdiel medzi revíziami

Z SensorWiki

(Návody)
Riadok 14: Riadok 14:
 
* [https://www.sparkfun.com/products/14213 SparkFun moto:bit] + [https://cdn.sparkfun.com/assets/3/9/c/7/d/SparkFun_Micro_Bit_Moto_Bit.pdf schematic diagram]
 
* [https://www.sparkfun.com/products/14213 SparkFun moto:bit] + [https://cdn.sparkfun.com/assets/3/9/c/7/d/SparkFun_Micro_Bit_Moto_Bit.pdf schematic diagram]
 
* [https://learn.sparkfun.com/tutorials/microbot-kit-experiment-guide micro:bot Kit Experiment Guide]
 
* [https://learn.sparkfun.com/tutorials/microbot-kit-experiment-guide micro:bot Kit Experiment Guide]
 +
 +
 +
[[Image:KitronikMoveRobot.jpeg|left|100px]]
 +
* '''Kitronik:MOVE'''
 +
* [https://www.kitronik.co.uk/5624-move-mini-buggy-kit-excl-microbit.html] product page
 +
* [https://www.kitronik.co.uk/blog/lesson-plans-for-move-mini-microbit/ 4 Lesson Plans for MOVE]
 +
* [https://www.kitronik.co.uk/blog/move-mini-microbit-radio/ Controlling :MOVE mini With The microbit Radio]
 +
* [https://www.kitronik.co.uk/blog/drawing-move-mini-buggy/ Drawing With The :MOVE mini For The microbit]
  
  

Verzia zo dňa a času 10:04, 20. február 2019

Návody

SparkfunExpansionConnector.jpeg



SparkfunMicroBot.jpeg


KitronikMoveRobot.jpeg


MicroBitEdgeConnector.png
SensorHC-SR-04.jpeg
  • Ultrazvukový senzor
  • [2] Zapojenie, je potrebné napájanie?
  • pulse-in príkaz
  • [3] sonar package

7. marca 2018

Vymeniť CMOS baterky v PC aby si pamätal čas.

Skupina 15:00 chodili robotom po čiare, potrebujeme vyriešiť analógový vstup senzorov.

Skupina 12:30 robili sme diaľkové ovládanie robota druhým microbitom. A+B - rovno, A - doprava, B - doľava inak stop. Fungovalo.


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(`
            . # # # .
            # # . # #
            # . # . #
            # # . # #
            . # # # .
            `)
    }
})
input.onButtonPressed(Button.A, () => {
    motobit.setMotorSpeed(Motor.Right, MotorDirection.Forward, 100)
    basic.showLeds(`
        . . . . .
        . . # . .
        . . # . .
        . . . . .
        . . . . .
        `)
})
input.onButtonPressed(Button.B, () => {
    motobit.enable(MotorPower.On)
    basic.showLeds(`
        # . . . .
        . # . . .
        . . # . .
        . . . # .
        . . . . #
        `)
})
function ON()  {
    motobit.enable(MotorPower.On)
}
function OFF()  {
    motobit.enable(MotorPower.Off)
}
function 前進()  {
    motobit.setMotorSpeed(Motor.Right, MotorDirection.Forward, 30)
    motobit.setMotorSpeed(Motor.Left, MotorDirection.Forward, 30)
}
radio.onDataPacketReceived( ({ receivedString }) =>  {
    if (receivedString == "ON") {
        ON()
    } else if (receivedString == "OFF") {
        OFF()
    } else if (receivedString == "FORWARD") {
        前進()
    } else if (receivedString == "BACK") {
        後進()
    } else if (receivedString == "RIGHT") {
        右折()
    } else if (receivedString == "LEFT") {
        左折()
    } else {
        OFF()
    }
})
function 左折()  {
    motobit.setMotorSpeed(Motor.Right, MotorDirection.Forward, 30)
    motobit.setMotorSpeed(Motor.Left, MotorDirection.Reverse, 30)
}
function 右折()  {
    motobit.setMotorSpeed(Motor.Right, MotorDirection.Reverse, 30)
    motobit.setMotorSpeed(Motor.Left, MotorDirection.Forward, 30)
}
function 後進()  {
    motobit.setMotorSpeed(Motor.Right, MotorDirection.Reverse, 30)
    motobit.setMotorSpeed(Motor.Left, MotorDirection.Reverse, 30)
}
radio.setGroup(1)
basic.showLeds(`
    . . # . .
    . . . . .
    # # # # #
    . . . . .
    . . # . .
    `)