... | ... | @@ -22,7 +22,9 @@ This lab enables students to learn about communication interception through a ha |
|
|
Radios work by sending and receiving messages over different channels. This allows you to use on Micro:Bit to send messages and another to receive them. In this lab, you will use a Micro:bit as a controller to get user input and then send messages based on those inputs. Then, you will use a second Micro:bit to receive messages from the controller and then control the robot based on those received messages.
|
|
|
|
|
|
Start this lab by going over this basic programming example.
|
|
|
|
|
|
![microbot_base](/uploads/4d503fa07bae7006844b98ce34f21c9c/microbot_base.PNG)
|
|
|
|
|
|
![microbot_base2](/uploads/b3d7faa28897c949e874714f4a172d98/microbot_base2.PNG)
|
|
|
|
|
|
The first set of code is for the Micro:Bit controller. This controller waits for the user to press the A button or the B button. When the user presses the A button, the controller sends the message "left" to the robot. When the user presses the B button, the controller sends the message "right" to the robot.
|
... | ... | @@ -47,7 +49,22 @@ The second set of code is for the Micro:Bot robot. This Micro:Bit waits to recei |
|
|
|
|
|
* For Python, you can use Mu ([click here to see Mu](https://codewith.mu/)) or the online editor ([click here to get to the online editor](http://python.microbit.org/v/1)).
|
|
|
|
|
|
_06-Show how to import Microbot Library in each editor_
|
|
|
### Step 5: Get Moto-Bit library.
|
|
|
* For JavaScript/Blocks, start by selecting the "Advanced" drop down box in the libraries toolbar.
|
|
|
|
|
|
![microbot_lib1](/uploads/8b8abbdeb2a7281e77d469955ce2fa39/microbot_lib1.PNG)
|
|
|
|
|
|
Then, scroll down to the bottom of the advanced packages. Select the "Add Package" button.
|
|
|
|
|
|
![microbot_lib2](/uploads/c7d115e43780db9bc76507cb328775d6/microbot_lib2.PNG)
|
|
|
|
|
|
In the packages pop-up, search for "Motobit". Select the moto-bit library in the results section.
|
|
|
|
|
|
![microbot_lib3](/uploads/6234309751210b5cf120a4cd236cb34f/microbot_lib3.PNG)
|
|
|
|
|
|
You can check to make sure that you have the library by searching for the library in your libraries toolbar.
|
|
|
|
|
|
![microbot_lib4](/uploads/50880517646fef4065f781d017771d02/microbot_lib4.PNG)
|
|
|
|
|
|
### Step 6: Programming!
|
|
|
1. Partner up
|
... | ... | |