Class: TachoMotor

TachoMotor()

new TachoMotor()

Source:

Extends

Members

(readonly) connected

Properties:
Name Type Description
connected boolean

Check if the device is still attached.

Inherited From:
Source:

(readonly) hub

Properties:
Name Type Description
hub Hub

The Hub the device is attached to.

Inherited From:
Source:

(readonly) isVirtualPort

Properties:
Name Type Description
isVirtualPort boolean

Is this device attached to a virtual port (ie. a combined device)

Inherited From:
Source:

(readonly) mode

Properties:
Name Type Description
mode number

The mode the device is currently in

Inherited From:
Source:

(readonly) portName

Properties:
Name Type Description
portName string

The port the device is attached to.

Inherited From:
Source:

(readonly) type

Properties:
Name Type Description
type number

The type of the device

Inherited From:
Source:

Methods

brake() → {Promise.<CommandFeedback>}

Brake the motor. Previous commands that have not completed are discarded.

Inherited From:
Source:
Returns:

Resolved upon completion of command.

Type
Promise.<CommandFeedback>

rampPower(fromPower, toPower, time) → {Promise.<CommandFeedback>}

Ramp the motor power.

Parameters:
Name Type Description
fromPower number

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower number

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time number

How long the ramp should last (in milliseconds).

Inherited From:
Source:
Returns:

Resolved upon completion of command.

Type
Promise.<CommandFeedback>

rotateByDegrees(degrees, speedopt, interruptopt) → {Promise.<CommandFeedback>}

Rotate a motor by a given amount of degrees.

Parameters:
Name Type Attributes Default Description
degrees number

How much the motor should be rotated (in degrees).

speed number <optional>
100

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

interrupt boolean <optional>
false

If true, previous commands are discarded.

Source:
Returns:

Resolved upon completion of command (i.e. once the motor is finished).

Type
Promise.<CommandFeedback>

setAccelerationTime(time, profile, interruptopt) → {Promise.<CommandFeedback>}

Set the global acceleration time

Parameters:
Name Type Attributes Default Description
time number

How long acceleration should last (in milliseconds).

profile number

0 by default

interrupt boolean <optional>
false

If true, previous commands are discarded.

Source:
Returns:

Resolved upon completion of command (i.e. once the motor is finished).

Type
Promise.<CommandFeedback>

setBrakingStyle(style)

Set the braking style of the motor.

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

Parameters:
Name Type Description
style number

Either BRAKE or HOLD

Source:

setDecelerationTime(time, profile, interruptopt) → {Promise.<CommandFeedback>}

Set the global deceleration time

Parameters:
Name Type Attributes Default Description
time number

How long deceleration should last (in milliseconds).

profile number

0 by default

interrupt boolean <optional>
false

If true, previous commands are discarded.

Source:
Returns:

Resolved upon completion of command (i.e. once the motor is finished).

Type
Promise.<CommandFeedback>

setMaxPower(style)

Set the max power of the motor.

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

Parameters:
Name Type Description
style number

Either BRAKE or HOLD

Source:

setPower(power, interruptopt) → {Promise.<CommandFeedback>}

Set the motor power.

Parameters:
Name Type Attributes Default Description
power number

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

interrupt boolean <optional>
false

If true, previous commands are discarded.

Inherited From:
Source:
Returns:

Resolved upon completion of command.

Type
Promise.<CommandFeedback>

setSpeed(speed, time, interruptopt) → {Promise.<CommandFeedback>}

Set the motor speed.

Parameters:
Name Type Attributes Default Description
speed number

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time number

How long the motor should run for (in milliseconds).

interrupt boolean <optional>
false

If true, previous commands are discarded.

Source:
Returns:

Resolved upon completion of command (i.e. once the motor is finished).

Type
Promise.<CommandFeedback>

stop() → {Promise.<CommandFeedback>}

Stop the motor. Previous commands that have not completed are discarded.

Inherited From:
Source:
Returns:

Resolved upon completion of command.

Type
Promise.<CommandFeedback>

Events

rotate

Emits when a rotation sensor is activated.

Type:
  • object
Parameters:
Name Type Description
rotation number
Source: