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>“ |
|||
(22 medziľahlých úprav od 2 ďalších používateľov nie je zobrazených) | |||
Riadok 1: | Riadok 1: | ||
'''7. | == Harmonogram == | ||
Hlasujte kedy chcete chodievat: https://doodle.com/poll/dns5sfptrh96q86w | |||
== '''Návody''' == | |||
[[Image:SparkfunExpansionConnector.jpeg|left|100px]] | |||
* '''Expansion connector''' | |||
* [https://www.sparkfun.com/products/13989 SparkFun micro:bit Breakout] product page | |||
* [https://learn.sparkfun.com/tutorials/microbit-breakout-board-hookup-guide Hookup guide] | |||
* [https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-microbit-experiment-guide/experiment-11-using-the-compass Experiment guide] | |||
<BR><BR> | |||
[[Image:SparkfunMBIK.jpeg|left|100px]] | |||
* '''Inventor Kit''' | |||
* [https://www.sparkfun.com/products/14542 SparkFun micro:bit Inventor Kit] product page | |||
* [https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-microbit-experiment-guide Experiment guide] | |||
<BR><BR> | |||
[[Image:SparkfunWeather.jpeg|left|100px]] | |||
'''SparkFun micro:climate kit''' | |||
* [https://www.sparkfun.com/products/14217 SparkFun micro:climate Kit] product page | |||
* [https://learn.sparkfun.com/tutorials/microclimate-kit-experiment-guide Experiment guide] | |||
<BR><BR> | |||
[[Image:SparkfunMicroBot.jpeg|left|100px]] | |||
* '''micro:bot''' | |||
* [https://www.sparkfun.com/products/14216 SparkFun micro:bot kit] product page | |||
* [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] | |||
[[Image:KitronikMoveRobot.jpeg|left|100px]] | |||
* '''Kitronik:MOVE''' | |||
* [https://www.kitronik.co.uk/5624-move-mini-buggy-kit-excl-microbit.html Kitronik :MOVE] 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] | |||
[[Súbor:microBitEdgeConnector.png|center|300px]] | |||
[[Image:SensorHC-SR-04.jpeg|left|100px]] | |||
* '''Ultrazvukový senzor''' | |||
* [http://www.makerspace-uk.co.uk/hc-sr04-ultrasonic-sensor/] Zapojenie, je potrebné napájanie? | |||
* [https://makecode.microbit.org/reference/pins/pulse-in pulse-in] príkaz | |||
* [https://microbit-playground.co.uk/components/ultrasound-distance-sensor] sonar package | |||
== '''Programovanie''' == | |||
# Blockly - [https://makecode.microbit.org/ skok do editora] / [https://makecode.microbit.org/reference príručka] / [https://microbit.org/en/2017-03-07-javascript-block-resources/ projekty] | |||
# Javascript - [https://makecode.microbit.org/ skok do editora] (ten istý) | |||
# Python - [https://python.microbit.org/ skok do editora] / [https://microbit.org/guide/python/ príručka] | |||
# C, C++ - [https://learn.adafruit.com/use-micro-bit-with-arduino/overview Arduino] | |||
# C, C++ - [https://os.mbed.com/platforms/Microbit/ mbed C++] | |||
# C, C++ - [https://www.instructables.com/id/BBC-Microbit-C-Getting-Started/ offline version] (Netbeans) | |||
# ostatné [https://microbit.org/code-alternative-editors/ Scratch, Kodu, Matlab,...] | |||
== '''WebUSB''' == | |||
WebUSB je nová funkcionalita, ktorá umožňuje mať priamo pripojený microbit k webovej aplikácii. Rovnako funguje | |||
aj Win10 aplikácia, kedy sa priamo programuje a komunikuje. | |||
# Google Chrome v 65+ (other browsers do not yet have Web USB support) | |||
# Update firmware https://microbit.org/guide/firmware/ | |||
## Pripoj microbit so stlacenym RESET tlacitkom - objavi sa ako disk MAINTENANCE (nie ako obvykle microbit) | |||
## Nakopiruj novy firmware > 0250 | |||
## Skontroluj DETAILS.TXT na microbite | |||
# Hotovo. The settings menu in MakeCode should contain an additional menu item entitled Pair Device | |||
Zdroj: https://support.microbit.org/support/solutions/articles/19000084059-beta-testing-web-usb | |||
== '''Správy''' == | |||
=== 7. 3. 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. | |||
* [https://makecode.microbit.org/_04AbrA8i80yA program pre ovládač] | |||
* [https://makecode.microbit.org/_6zb3tAf8DTjT program pre micro:bot] | |||
<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 lang="javascript"> | |||
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(` | |||
. . # . . | |||
. . . . . | |||
# # # # # | |||
. . . . . | |||
. . # . . | |||
`) | |||
</source> | </source> |
Aktuálna revízia z 10:34, 30. máj 2019
Harmonogram
Hlasujte kedy chcete chodievat: https://doodle.com/poll/dns5sfptrh96q86w
Návody
![](/sensorwiki/images/thumb/5/5a/SparkfunExpansionConnector.jpeg/100px-SparkfunExpansionConnector.jpeg)
- Expansion connector
- SparkFun micro:bit Breakout product page
- Hookup guide
- Experiment guide
![](/sensorwiki/images/thumb/8/8c/SparkfunMBIK.jpeg/100px-SparkfunMBIK.jpeg)
- Inventor Kit
- SparkFun micro:bit Inventor Kit product page
- Experiment guide
![](/sensorwiki/images/thumb/b/ba/SparkfunWeather.jpeg/100px-SparkfunWeather.jpeg.png)
SparkFun micro:climate kit
- SparkFun micro:climate Kit product page
- Experiment guide
![](/sensorwiki/images/thumb/c/c5/SparkfunMicroBot.jpeg/100px-SparkfunMicroBot.jpeg)
- micro:bot
- SparkFun micro:bot kit product page
- SparkFun moto:bit + schematic diagram
- micro:bot Kit Experiment Guide
![](/sensorwiki/images/thumb/d/d6/KitronikMoveRobot.jpeg/100px-KitronikMoveRobot.jpeg)
- Kitronik:MOVE
- Kitronik :MOVE product page
- 4 Lesson Plans for MOVE
- Controlling :MOVE mini With The microbit Radio
- Drawing With The :MOVE mini For The microbit
![](/sensorwiki/images/thumb/3/38/MicroBitEdgeConnector.png/300px-MicroBitEdgeConnector.png)
![](/sensorwiki/images/thumb/1/1a/SensorHC-SR-04.jpeg/100px-SensorHC-SR-04.jpeg)
Programovanie
- Blockly - skok do editora / príručka / projekty
- Javascript - skok do editora (ten istý)
- Python - skok do editora / príručka
- C, C++ - Arduino
- C, C++ - mbed C++
- C, C++ - offline version (Netbeans)
- ostatné Scratch, Kodu, Matlab,...
WebUSB
WebUSB je nová funkcionalita, ktorá umožňuje mať priamo pripojený microbit k webovej aplikácii. Rovnako funguje aj Win10 aplikácia, kedy sa priamo programuje a komunikuje.
- Google Chrome v 65+ (other browsers do not yet have Web USB support)
- Update firmware https://microbit.org/guide/firmware/
- Pripoj microbit so stlacenym RESET tlacitkom - objavi sa ako disk MAINTENANCE (nie ako obvykle microbit)
- Nakopiruj novy firmware > 0250
- Skontroluj DETAILS.TXT na microbite
- Hotovo. The settings menu in MakeCode should contain an additional menu item entitled Pair Device
Zdroj: https://support.microbit.org/support/solutions/articles/19000084059-beta-testing-web-usb
Správy
7. 3. 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(`
. . # . .
. . . . .
# # # # #
. . . . .
. . # . .
`)