mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-27 19:57:02 +00:00
doc: autodoc for init
test syntax for autolinking to types test syntax to avoid evaluating enum arguments to numbers
This commit is contained in:
@@ -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
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user