파이썬 비동기 사용하기. async, await, runloop
while distance_sensor.distance(port.D) < 150: motor_pair.move(motor_pair.PAIR_1, 0) async def main(): await motor_pair.move_for_time(motor_pair.PAIR_1, 2000, 50) await motor.run_for_degrees(port.C, 70, 100) runloop.run(main()) async를 사용하고 await를 이렇게 사용해야 모터가 동시에 작동을 안하고 하나씩 순차적으로 작동한다.
2024.03.06