class EV3D4WebControlled(WebControlledTank):
    def __init__(self,
                 left_motor_port: str = OUTPUT_B,
                 right_motor_port: str = OUTPUT_C,
                 medium_motor_port: str = OUTPUT_A):
        super().__init__(left_motor=left_motor_port,
                         right_motor=right_motor_port,
                         polarity='inversed')

        self.medium_motor = MediumMotor(address=medium_motor_port)
        self.medium_motor.reset()
class EV3D4RemoteControlled(RemoteControlledTank):
    """
    Base class for all Track3r variations.
    The only difference in the child classes are in how the medium motor is handled.
    To enable the medium motor toggle the beacon button on the EV3 remote.
    """
    def __init__(self,
                 left_motor_port: str = OUTPUT_B,
                 right_motor_port: str = OUTPUT_C,
                 medium_motor_port: str = OUTPUT_A):
        super().__init__(left_motor=left_motor_port,
                         right_motor=right_motor_port,
                         polarity='inversed')

        self.medium_motor = MediumMotor(address=medium_motor_port)
        self.medium_motor.reset()
예제 #3
0
#!/usr/bin/python

from ev3dev.ev3 import MediumMotor as MediumMotor
from ev3dev.ev3 import LargeMotor as LargeMotor
from time import sleep

a = MediumMotor(address='outA')
b = LargeMotor(address='outB')
c = LargeMotor(address='outC')

a.reset()
b.reset()
c.reset()

a.position_sp = 50
a.duty_cycle_sp = 50
a.command = 'run-to-abs-pos'

b.position_sp = -450
b.duty_cycle_sp = 50
b.command = 'run-to-abs-pos'

c.position_sp = -450
b.duty_cycle_sp = 50
b.command = 'run-to-abs-pos'

sleep(5)