22 lines
491 B
Python
22 lines
491 B
Python
'''
|
|
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") |