... | ... | @@ -72,12 +72,9 @@ The second set of code is for the Micro:Bot robot. This Micro:Bit waits to recei |
|
|
|
|
|
## Step 3: Download The Files
|
|
|
* Download (click on) the following file to get started: [MicroBotLab.zip](/uploads/99bcb034cdee9aad07dcc403efcdbe35/MicroBotLab.zip)
|
|
|
|
|
|
* Unzip MicroBotLab.zip to your desired folder. For **instructions** on how to unzip click [here](how-to-download-and-open)
|
|
|
|
|
|
## Step 3: Download The Files
|
|
|
* **NOTE**: There is an extra folder for this lab, **Attackers**
|
|
|
* **Attackers**: This directory holds code to simulate an attack that jams the radio channel and makes the robots behave chaotically.
|
|
|
* **Attackers**: This directory holds code to simulate an attack that jams the radio channel and makes the robots behave chaotically.
|
|
|
|
|
|
## Step 4: Open your editor
|
|
|
* This base code is also available in the directory that you downloaded as well as this repository. If you don't remember how to open code in your editor, see the **instructions** [here](how-to-download-and-open).
|
... | ... | @@ -114,14 +111,15 @@ You can check to make sure that you have the library by searching for the librar |
|
|
8. Paste your code into the editor
|
|
|
9. If you are using Blocks, to get back to blocks, you can select the Blocks button in the center-top of the page.
|
|
|
2. Complete the robot code. You will add channel choosing functionality and give the motobit commands after receiving a radio transmission from the controller:
|
|
|
* When button a and b are pressed, set the radio group
|
|
|
* When button a is pressed, if the radio group has not been set, decrement the radio group by 1
|
|
|
* When button b is pressed, if the radio group has not been set, increment the radio group by 1
|
|
|
* When the command "forward" is received over the radio, drive the mototbit Forward
|
|
|
* When the command "stop" is received over the radio, stop the motobit
|
|
|
* When the command "left" is received over the radio, drive the mototbit left
|
|
|
* When the command "right" is received over the radio, drive the mototbit right
|
|
|
3. Generate your robot .hex file and flash your robot Micro::Bit. If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
* When *button a* and *button b* are pressed, set the radio group
|
|
|
* When *button a* is pressed, if the radio group has not been set, decrement the radio group by 1
|
|
|
* When *button b* is pressed, if the radio group has not been set, increment the radio group by 1
|
|
|
* When the command *forward* is received over the radio, drive the mototbit Forward
|
|
|
* When the command *stop* is received over the radio, stop the motobit
|
|
|
* When the command *left* is received over the radio, drive the mototbit left
|
|
|
* When the command *right* is received over the radio, drive the mototbit right
|
|
|
|
|
|
3. Generate your robot **.hex file** and flash your robot Micro::Bit. If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
|
|
|
### Compelete the Controller code
|
|
|
1. Open the controller base code by:
|
... | ... | @@ -135,10 +133,14 @@ You can check to make sure that you have the library by searching for the librar |
|
|
8. Paste your code into the editor
|
|
|
9. If you are using Blocks, to get back to blocks, you can select the Blocks button in the center-top of the page.
|
|
|
2. Complete the controller base code. You will add channel choosing functionality and send radio commands depending on the buttons pressed:
|
|
|
* When button a and b are pressed, if the radio channel has not already been set, set it. if the radio channel has already been set, send a "forward" command over the radio
|
|
|
* When button a is pressed, if the radio group has not been set, decrement the radio group by 1. if the radio group has been set, send a "left" command over the radio
|
|
|
* When button b is pressed, if the radio group has not been set, increment the radio group by 1. if the radio group has been set, send a "right" command over the radio
|
|
|
3. Generate your controller .hex file and flash your controller Micro::Bit. If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
* When *button a* and *button b* are pressed, if the radio channel has not already been set, set it.
|
|
|
* If the radio channel has already been set, send a *forward* command over the radio
|
|
|
* When *button a* is pressed, if the radio group has not been set, decrement the radio group by 1.
|
|
|
* If the radio group has been set, send a *left* command over the radio
|
|
|
* When button b is pressed, if the radio group has not been set, increment the radio group by 1.
|
|
|
* If the radio group has been set, send a *right* command over the radio
|
|
|
|
|
|
3. Generate your controller **.hex file** and flash your controller Micro::Bit. If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
|
|
|
<details>
|
|
|
<summary>
|
... | ... | |