This is a simple tethered application where you type in left and right wheel speeds, and run time in milliseconds, into a terminal. When you press Enter, your text gets parsed and executed by the micro:bit, which then makes the cyber:bot execute the maneuver.
Example Script: terminal_controlled_bot_tethered_intro
# terminal_controlled_bot_tethered_intro from cyberbot import * sleep(1000) print("\nSpeeds are -100 to 100\n") while(True): text = input("Enter left speed: ") vL = int(text) text = input("Enter right speed: ") vR = int(text) text = input("Enter ms to run: ") ms = int(text) bot(18).servo_speed(vL) bot(19).servo_speed(-vR) sleep(ms) bot(18).servo_speed(None) bot(19).servo_speed(None) print()
Since your cyber:bot is currently tethered, it’s best to use low speeds and short run times. Otherwise, your cyber:bot might try to roll beyond the tether length. In other words, it’ll try to unplug itself from the USB cable, or maybe roll off the table.
For example, what happens if you type abc and press enter? For now, you can press/release the reset button to restart the app. You will add some exception handling in the your turn section to prevent this from happening.