diff --git a/pybricks/ev3devices.py b/pybricks/ev3devices.py new file mode 100644 index 0000000..455c4a9 --- /dev/null +++ b/pybricks/ev3devices.py @@ -0,0 +1,53 @@ +"""EV3 motors and sensors.""" + +from parameters import Stop, Direction + + +class Motor(): + """Medium or Large EV3 motor.""" + + def __init__(self, port, direction=Direction.clockwise, gears=None): + """Motor(port, direction=Direction.clockwise, gears=None) + + Arguments: + port (Port): Port to which the motor is connected + direction (Direction): Positive speed direction. (*Default*: Direction.clockwise) + gears (list): List of the number of teeth on each gear in a gear train, as shown in the examples below. Use a list of lists for multiple gear trains. (*Default*: None) + :: + + Example for one gear train: gears=[12, 36] + ____________ + | | + | motor | + |____________| + || + || 12t 36t + |||||| |||||||||||||| + || + || + output axle + + + Example with multiple gear trains: gears=[[12, 20, 36], [20, 40], [20, 8, 40]] + _____________ + | | + | motor | + |____________| + || + || 12t 20t 36t + |||||| ||||||||||| |||||||||||||| + || + || + |||||||| ||||||||||||||||| + 20t || 40t + || + |||||||| ||| ||||||||||||||||| + 20t 8t || 40t + || + output axle + """ + pass + + def run_time(self, speed): + """Test docstring.""" + pass diff --git a/pybricks/parameters.py b/pybricks/parameters.py index 7046cad..6e13d1b 100644 --- a/pybricks/parameters.py +++ b/pybricks/parameters.py @@ -110,26 +110,6 @@ class Direction(): counterclockwise = -1 -class Completion(Enum): - """How the motor action should complete: foreground or background. - - Note: A motor can only do one thing at the time. If a motor is running in - the background and you give it a new command, only the new command applies. - - +-----------------------+-------------------------------------------------------------------+ - | Parameter | Effect | - +=======================+===================================================================+ - | Completion.foreground | Your script waits for the motor action to complete. | - +-----------------------+-------------------------------------------------------------------+ - | Completion.background | Your script continues immediately while the motor is still moving.| - +-----------------------+-------------------------------------------------------------------+ - - """ - - foreground = 0 - background = 1 - - class Button(Enum): """Buttons on a brick or remote: