... | ... | @@ -69,23 +69,23 @@ You can check to make sure that you have the library by searching for the librar |
|
|
### Step 6: Programming!
|
|
|
1. Partner up
|
|
|
2. Open the robot base code by:
|
|
|
1. Go to the files you downloaded from above
|
|
|
2. Double-click on the JavaScript or Python folder
|
|
|
3. Right-click on robot_base (JavaScript) or robot_base (Python)
|
|
|
4. Select "Open with Visual Code", "Open with Notepad++", or "Open with Notepad"
|
|
|
5. Highlight all of the text and copy it (right-click and copy or ctrl+c)
|
|
|
6. If you are using JavaScript/Blocks, in the editor, select the JavaScript button in the center-top of the page. If you are using Python, simply go to your editor.
|
|
|
7. Delete all of the existing code in the editor
|
|
|
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.
|
|
|
1. Go to the files you downloaded from above
|
|
|
2. Double-click on the JavaScript or Python folder
|
|
|
3. Right-click on robot_base (JavaScript) or robot_base (Python)
|
|
|
4. Select "Open with Visual Code", "Open with Notepad++", or "Open with Notepad"
|
|
|
5. Highlight all of the text and copy it (right-click and copy or ctrl+c)
|
|
|
6. If you are using JavaScript/Blocks, in the editor, select the JavaScript button in the center-top of the page. If you are using Python, simply go to your editor.
|
|
|
7. Delete all of the existing code in the editor
|
|
|
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.
|
|
|
3. Complete the robot code. You will add channel choosing functionality and give the motobit commands after receiving a radio transmission from the controller:
|
|
|
1. When button a and b are pressed, set the radio group
|
|
|
2. When button a is pressed, if the radio group has not been set, decrement the radio group by 1
|
|
|
3. When button b is pressed, if the radio group has not been set, increment the radio group by 1
|
|
|
4. When the command "forward" is received over the radio, drive the mototbit Forward
|
|
|
5. When the command "stop" is received over the radio, stop the motobit
|
|
|
6. When the command "left" is received over the radio, drive the mototbit left
|
|
|
7. When the command "right" is received over the radio, drive the mototbit right
|
|
|
1. When button a and b are pressed, set the radio group
|
|
|
2. When button a is pressed, if the radio group has not been set, decrement the radio group by 1
|
|
|
3. When button b is pressed, if the radio group has not been set, increment the radio group by 1
|
|
|
4. When the command "forward" is received over the radio, drive the mototbit Forward
|
|
|
5. When the command "stop" is received over the radio, stop the motobit
|
|
|
6. When the command "left" is received over the radio, drive the mototbit left
|
|
|
7. When the command "right" is received over the radio, drive the mototbit right
|
|
|
4. Generate your robot .hex file. From your editor, click on the "Download" button in the bottom right hand corner. This will download your .hex file. You can find it in the Downloads folder on your computer.
|
|
|
|
|
|
![download](/uploads/c3c3a26fb266867fc4cbe74a08ab952e/download.PNG)
|
... | ... | @@ -420,12 +420,12 @@ You can check to make sure that you have the library by searching for the librar |
|
|
|
|
|
6. Test your code.
|
|
|
* Your robot should:
|
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* wait for commands from the controller
|
|
|
* move forward, right, left, and stop when instructed to do so by controller
|
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* wait for commands from the controller
|
|
|
* move forward, right, left, and stop when instructed to do so by controller
|
|
|
* Your Controller should:
|
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* send commands to the robot upon various button presses: a+b is "start" and "stop", a is "left", b is "right"
|
|
|
* Allow radio group selection on startup and allow locking that radio group in
|
|
|
* send commands to the robot upon various button presses: a+b is "start" and "stop", a is "left", b is "right"
|
|
|
7. Now try to intercept other robots. Are you able to control another group's robot simply by changing what radio group you set your controller to?
|
|
|
|
|
|
|
... | ... | |