from ev3dev2.motor import MediumMotor motor = MediumMotor('outA') motor.on_for_degrees(50, 180) motor.stop()
from ev3dev2.motor import MediumMotor motor = MediumMotor('outB') motor.on_for_degrees(-75, 360) motor.on_for_degrees(-25, -90) motor.stop()In both of these examples, the code first imports the ev3dev2.motor package, then creates a MediumMotor object connected to a specific output port (outA or outB). The on_for_degrees method is then called to run the motor, and the stop method is used to stop the motor once the desired number of degrees has been reached.