... | ... | @@ -86,10 +86,69 @@ You can check to make sure that you have the library by searching for the librar |
|
|
7. Now try to intercept other robots
|
|
|
|
|
|
### Step 7: Further Exploration
|
|
|
_08-2 or 3 thoughts for other things they could further their work with_
|
|
|
|
|
|
|
|
|
|
|
|
* Can you think of a way to incorporate a reverse function for the microbot? What if you needed to push and hold a+b to make it move in a direction? How would you select between forward and reverse? Spend some time exploring with your Micro::Bit and see what kind of improvements you can make.
|
|
|
|
|
|
<details>
|
|
|
<summary>
|
|
|
Potential Python Solution (Click to Expand)
|
|
|
</summary>
|
|
|
<pre>
|
|
|
from microbit import *
|
|
|
import radio
|
|
|
|
|
|
radio_group = 0 #number of radio frequency to use
|
|
|
forward = False
|
|
|
group_set = False #has the radio group been set?
|
|
|
radio.on()
|
|
|
radio.config(power=7)
|
|
|
|
|
|
stop_sign = Image( "09990:"
|
|
|
"90099:"
|
|
|
"90909:"
|
|
|
"99009:"
|
|
|
"09990")
|
|
|
|
|
|
while True:# do forever
|
|
|
if group_set is False:
|
|
|
display.show(str(radio_group))
|
|
|
|
|
|
if button_a.is_pressed() and button_b.is_pressed():
|
|
|
if group_set is False:
|
|
|
group_set = True
|
|
|
radio.config(channel = radio_group)
|
|
|
display.show(Image.HAPPY)
|
|
|
forward = False
|
|
|
else:
|
|
|
if reverse == False:
|
|
|
radio.send("reverse")
|
|
|
reverse = True
|
|
|
display.show(Image.ARROW_S)
|
|
|
else:
|
|
|
radio.send("stop")
|
|
|
forward = False
|
|
|
display.show(stop_sign)
|
|
|
|
|
|
elif button_a.is_pressed():
|
|
|
if group_set == False and radio_group > 0 :
|
|
|
radio_group = radio_group - 1
|
|
|
else:
|
|
|
radio.send("left")
|
|
|
display.show(Image.ARROW_W)
|
|
|
|
|
|
elif button_b.is_pressed():
|
|
|
if group_set is False and radio_group < 255:
|
|
|
radio_group = radio_group + 1
|
|
|
else:
|
|
|
radio.send("right")
|
|
|
display.show(Image.ARROW_E)
|
|
|
sleep(200)
|
|
|
</pre>
|
|
|
</details>
|
|
|
|
|
|
<br></br>
|
|
|
* Are you able to control another group's robot?
|
|
|
* Does your control work with their robot?
|
|
|
* How about after you play with the code?
|
|
|
---
|
|
|
>>>
|
|
|
The GenCyber Wyoming COWPOKES program is supported by the National Security Agency and the National Science Foundation through Award #H98230-18-1-0095. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation, the National Security Agency, or the U.S. government.
|
... | ... | |