# TrainMotor

#### new TrainMotor()

Source:
  - devices/trainmotor.js, line 25

### 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 76

#### (readonly) hub

##### Properties:

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

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

#### (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 120

#### (readonly) mode

##### Properties:

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

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

#### (readonly) portName

##### Properties:

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

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

#### (readonly) type

##### Properties:

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

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

### Methods

#### brake() → {Promise}

Brake the motor.

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

#### rampPower(fromPower, toPower, time) → {Promise}

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

#### setPower(power) → {Promise}

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

#### stop() → {Promise}

Stop the motor.

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