diff --git a/avanceret/hovercraft/controller/main.py b/avanceret/hovercraft/controller/main.py new file mode 100644 index 0000000..2fd5106 --- /dev/null +++ b/avanceret/hovercraft/controller/main.py @@ -0,0 +1,35 @@ +''' +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() diff --git a/avanceret/hovercraft/remote/main.py b/avanceret/hovercraft/remote/main.py new file mode 100644 index 0000000..ef6b278 --- /dev/null +++ b/avanceret/hovercraft/remote/main.py @@ -0,0 +1,22 @@ +''' +This is code for the hovercraft remote +''' +from microbit import * + +# We start by initiating radio communication +# We want a strong signal + +import radio + +radio.config(group=99, power=7) +radio.on() + +while True: + if accelerometer.was_gesture("down"): + radio.send("forward") + if accelerometer.was_gesture("up"): + radio.send("back") + if accelerometer.was_gesture("left"): + radio.send("left") + if accelerometer.was_gesture("right"): + radio,send("right") \ No newline at end of file