onlinecodesimulator/readme.md

749 B

import robot import time

robot.move(0.00006) while True: if robot.get_sensors()[0]["hitpoint"]["x"] is not None: robot.turn(0.001) elif robot.get_sensors()[1]["hitpoint"]["x"] is not None: robot.turn(-0.001) else: robot.turn(0) time.sleep(0.1)

import robot import time

robot.move(0.00006) while True: left = robot.get_sensors()[0]["distance"] right = robot.get_sensors()[1]["distance"] print(str(int(left)) + "\t" + str(int(right))) if left < 55: robot.turn(0.01) elif right < 55: robot.turn(-0.01) else: robot.turn(0) time.sleep(0.1)

import time import robot

robot.move(1) time.sleep(1.6) robot.move(0) robot.turn(1) time.sleep(2.2) robot.turn(0) robot.move(1)