# Class: TachoMotor

## TachoMotor

#### new TachoMotor()

  Source:
    - devices/tachomotor.js, line 26

### Extends

- BasicMotor

### Members

#### <readonly> connected

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `connected` | boolean | Check if the device is still attached.

  Inherited From:
    - Device#connected
  Source:
    - devices/device.js, line 75

#### <readonly> hub

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `hub` | Hub | The Hub the device is attached to.

  Inherited From:
    - Device#hub
  Source:
    - devices/device.js, line 82

#### <readonly> isVirtualPort

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `isVirtualPort` | boolean | Is this device attached to a virtual port (ie. a combined device)

  Inherited From:
    - Device#isVirtualPort
  Source:
    - devices/device.js, line 119

#### <readonly> mode

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mode` | number | The mode the device is currently in

  Inherited From:
    - Device#mode
  Source:
    - devices/device.js, line 109

#### <readonly> portName

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `portName` | string | The port the device is attached to.

  Inherited From:
    - Device#portName
  Source:
    - devices/device.js, line 92

#### <readonly> type

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `type` | number | The type of the device

  Inherited From:
    - Device#type
  Source:
    - devices/device.js, line 99

### Methods

#### brake()

  Brake the motor.

  Inherited From:
    - BasicMotor#brake
  Source:
    - devices/basicmotor.js, line 73

  ##### Returns:

  Resolved upon successful issuance of the command.

  Type
    Promise

#### rampPower(fromPower, toPower, time)

  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:
    - BasicMotor#rampPower
  Source:
    - devices/basicmotor.js, line 46

  ##### Returns:

  Resolved upon successful completion of command.

  Type
    Promise

#### rotateByDegrees(degrees [, speed])

  Rotate a motor by a given amount of degrees.

  ##### Parameters:

  Name | Type | Argument | 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.

  Source:
    - devices/tachomotor.js, line 139

  ##### Returns:

  Resolved upon successful completion of command (ie. once the motor is finished).

  Type
    Promise

#### setAccelerationTime(time)

  Set the global acceleration time

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `time` | number | How long acceleration should last (in milliseconds).

  Source:
    - devices/tachomotor.js, line 73

  ##### Returns:

  Resolved upon successful completion of command (ie. once the motor is finished).

  Type
    Promise

#### 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:
    - devices/tachomotor.js, line 53

#### setDecelerationTime(time)

  Set the global deceleration time

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `time` | number | How long deceleration should last (in milliseconds).

  Source:
    - devices/tachomotor.js, line 84

  ##### Returns:

  Resolved upon successful completion of command (ie. once the motor is finished).

  Type
    Promise

#### 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:
    - devices/tachomotor.js, line 63

#### setPower(power)

  Set the motor power.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `power` | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

  Inherited From:
    - BasicMotor#setPower
  Source:
    - devices/basicmotor.js, line 34

  ##### Returns:

  Resolved upon successful issuance of the command.

  Type
    Promise

#### setSpeed(speed, time)

  Set the motor speed.

  ##### Parameters:

  Name | Type | 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).

  Source:
    - devices/tachomotor.js, line 95

  ##### Returns:

  Resolved upon successful issuance of the command.

  Type
    Promise

#### stop()

  Stop the motor.

  Inherited From:
    - BasicMotor#stop
  Source:
    - devices/basicmotor.js, line 64

  ##### Returns:

  Resolved upon successful issuance of the command.

  Type
    Promise

### Events

#### rotate

  Emits when a rotation sensor is activated.

  ##### Type: object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `rotation` | number |

  Source:
    - devices/tachomotor.js, line 43

#### Search results