Motors
WasabiFan edited this page Jul 16, 2014
·
4 revisions
- constructor
- port: a
MotorPort
specifying a port to use, or a port number from 0-4
- port: a
- read-only properties
-
position
: number of tacho ticks that the motor has counted since it was plugged in -
type
: the type of motor (either 'tacho' or 'minitacho')
-
- properties
-
targetSpeed
: a number between -100 and +100 to try to drive the motor at -
run
: indicates whether to run the motor or not -
regulationMode
: indicates if the speed should be actively adjusted to stay at the specified target -
stopMode
: indicates the desired action for stopping the motor (described below)
-
- methods
-
startMotor
: starts the motor according to the provided options as described below -
runServo
: Moves the motor accurately according to it's measured position. The available options can be found below. -
brake
: stops the motor by momentarily reversing it -
hold
: stops the motor and actively holds it in place -
coast
: stops powering the motor and lets it coast
-
-
MotorPort
A
B
C
D
- Servo run options
-
targetSpeed
: number. The target speed, on a scale of -100 to +100. -
positionMode
: number. If set to "absolute" the position specified will be treated absolutely. -
stopMode
: string.- "coast" Allows the motor to freely coast when it stops.
- "brake" Will short the motor terminals (don't worry, it's safe) to try to immediately stop the motors.
- "hold" Actively runs the motor after it stops to try to keep it in the same place (recommended).
-
- Motor run options
-
targetSpeed
: number. The target speed, on a scale of -100 to +100. -
run
: boolean. Indicates whether to actually run the motor. Use this to stop the motor according to thestopMode
. -
regulationMode
: boolean. Indicates whether to actively regulate power to maintain speed. -
time
: number. Controls how long (in milliseconds) the motor will run for. Leave undefined for unlimited. -
stopMode
: string.- "coast" Allows the motor to freely coast when it stops.
- "brake" Will short the motor terminals (don't worry, it's safe) to try to immediately stop the motors.
- "hold" Actively runs the motor after it stops to try to keep it in the same place.
-
Note: Words highlighted like this
are property names.