Transmitter

from microbit import *
radio.on()
radio.set_frequency_band(22)
 
pressure_pin = pins.P0
min_pressure = 200         # Minimum pressure for movement
max_pressure = 400        # Maximum pressure reading
 
def on_forever():
    pressure = pressure_pin.read_analog()
    if pressure > min_pressure:
        speed = int((pressure - min_pressure) / (max_pressure - min_pressure) * 100)  # Scale speed from 0 to 100
        radio.send(f"forward:{speed}") # Send speed along with command
        display.show(Image.ARROW_N)
    elif input.button_is_pressed(Button.A):
        radio.send("left")
        display.show(Image.ARROW_W)
    elif input.button_is_pressed(Button.B)
        radio.send("right")
        display.show(Image.ARROW_E)
    else:
        radio.send("stop")
        display.clear()
 
basic.forever(on_forever)

Reciver

from microbit import *
 
radio.on()
radio.set_frequency_band(22)
 
def on_forever():
    incoming = radio.receive()
    if incoming:
        if incoming.startswith("forward:"):
            speed = int(incoming.split(":")[1])
            cutebot.forward(speed)
            cutebot.set_headlight(cutebot.RGBLights.RGB_R, 255, 255, 255)  # Turn on headlights (white)
            display.show(Image.ARROW_N)
        elif incoming == "left":
            cutebot.motors(-50, 50)
            cutebot.set_headlight(cutebot.RGBLights.RGB_R, 0, 0, 0)   # Turn off headlights
            display.show(Image.ARROW_W)
        elif incoming == "right":
            cutebot.motors(50, -50)
            cutebot.set_headlight(cutebot.RGBLights.RGB_R, 0, 0, 0)  # Turn off headlights                
            display.show(Image.ARROW_E)
        elif incoming == "stop":
            cutebot.stop()
            cutebot.set_headlight(cutebot.RGBLights.RGB_R, 0, 0, 0)   # Turn off headlights
            display.clear()
 
basic.forever(on_forever)