Load this application into the micro:bit (or cyber:bot) you want to use as your tilt controller for your cyber:bot that’s running the radio_tilt_controlled_cyberbot script.
The radio_tilt_controller script is just radio_tilt_controller_w_stop_range from Receiver Full Tilt Control & Stop Range [1]. It is repeated here for folks who skip the majority of the tutorial and go directly to running the application.
# radio_tilt_controller from microbit import * import math import radio radio.on() radio.config(channel=7, queue=1, length=64) while True: x = accelerometer.get_x() y = accelerometer.get_y() angle = round( math.degrees( math.atan2(y, x) ) ) needle = ( angle + 90 + 15 ) // 30 if abs(y) > 80: display.show(Image.ALL_CLOCKS[needle]) else: display.show(Image.DIAMOND_SMALL) dictionary = { } dictionary['x'] = x dictionary['y'] = y dictionary['needle'] = needle packet = str(dictionary) radio.send(packet) sleep(50)
Links
[1] https://learn.parallax.com/tutorials/robot/cyberbot/cybersecurity-radio-tilt-control/adding-stop-range/receiver-full-tilt