36 lines
565 B
Python
36 lines
565 B
Python
'''
|
|
This is code for the hovercraft onboard controller
|
|
'''
|
|
from microbit import *
|
|
|
|
# We start by initiating radio communication
|
|
# We want a strong signal
|
|
|
|
import radio
|
|
|
|
radio.config(group=99, power=7)
|
|
radio.on()
|
|
|
|
def move_forward():
|
|
pass
|
|
|
|
def move_back():
|
|
pass
|
|
|
|
def turn_right():
|
|
pass
|
|
|
|
def turn_left():
|
|
pass
|
|
|
|
while True:
|
|
command = radio.receive()
|
|
if command == "forward":
|
|
move_forward()
|
|
elif command == "back":
|
|
move_back()
|
|
elif command == "right":
|
|
turn_right()
|
|
elif command == "left":
|
|
turn_left()
|