# Classes

##

### Classes

BoostMoveHub
ControlPlusHub
DuploTrainBase
Hub
LPF2Hub
PoweredUP
PUPHub
PUPRemote
WeDo2SmartHub

### Events

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Inherited From:
    - LPF2Hub#event:accel
  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Overrides:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Inherited From:
    - LPF2Hub#event:color
  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:colorAndDistance
  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Overrides:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:distance
  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Inherited From:
    - LPF2Hub#event:rotate
  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Inherited From:
    - LPF2Hub#event:speed
  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Inherited From:
    - LPF2Hub#event:temp
  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Inherited From:
    - LPF2Hub#event:tilt
  Source:
    - lpf2hub.js, line 443

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Inherited From:
    - LPF2Hub#event:accel
  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Overrides:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Inherited From:
    - LPF2Hub#event:color
  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:colorAndDistance
  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Overrides:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:distance
  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Inherited From:
    - LPF2Hub#event:rotate
  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Inherited From:
    - LPF2Hub#event:speed
  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Inherited From:
    - LPF2Hub#event:temp
  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Inherited From:
    - LPF2Hub#event:tilt
  Source:
    - lpf2hub.js, line 443

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Inherited From:
    - LPF2Hub#event:accel
  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Overrides:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Inherited From:
    - LPF2Hub#event:color
  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:colorAndDistance
  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Overrides:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:distance
  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Inherited From:
    - LPF2Hub#event:rotate
  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Inherited From:
    - LPF2Hub#event:speed
  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Inherited From:
    - LPF2Hub#event:temp
  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Inherited From:
    - LPF2Hub#event:tilt
  Source:
    - lpf2hub.js, line 443

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Source:
    - hub.js, line 217

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Source:
    - hub.js, line 229

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Source:
    - lpf2hub.js, line 443

#### discover

  Emits when a Powered UP Hub device is found.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `hub` | WeDo2SmartHub | BoostMoveHub | ControlPlusHub | PUPHub | PUPRemote | DuploTrainBase |

  Source:
    - poweredup-node.js, line 135

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Inherited From:
    - LPF2Hub#event:accel
  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Overrides:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Inherited From:
    - LPF2Hub#event:color
  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:colorAndDistance
  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Overrides:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:distance
  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Inherited From:
    - LPF2Hub#event:rotate
  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Inherited From:
    - LPF2Hub#event:speed
  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Inherited From:
    - LPF2Hub#event:temp
  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Inherited From:
    - LPF2Hub#event:tilt
  Source:
    - lpf2hub.js, line 443

#### accel

  Emits when accelerometer detects movement. Measured in DPS - degrees per second.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |
  `z` | number |

  Inherited From:
    - LPF2Hub#event:accel
  Source:
    - lpf2hub.js, line 358

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Overrides:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - lpf2hub.js, line 198

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Inherited From:
    - LPF2Hub#event:color
  Source:
    - lpf2hub.js, line 410

#### colorAndDistance

  A combined color and distance event, emits when the sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:colorAndDistance
  Source:
    - lpf2hub.js, line 426

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Overrides:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Inherited From:
    - LPF2Hub#event:distance
  Source:
    - lpf2hub.js, line 400

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Inherited From:
    - LPF2Hub#event:rotate
  Source:
    - lpf2hub.js, line 456

#### speed

  Emits on a speed change.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `speed` | number |

  Inherited From:
    - LPF2Hub#event:speed
  Source:
    - lpf2hub.js, line 516

#### temp

  Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.
  `temp` | number |

  Inherited From:
    - LPF2Hub#event:temp
  Source:
    - lpf2hub.js, line 380

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string | If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.
  `x` | number |
  `y` | number |
  `z` | number | (Only available when using a Control+ Hub)

  Inherited From:
    - LPF2Hub#event:tilt
  Source:
    - lpf2hub.js, line 443

#### attach

  Emits when a motor or sensor is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `type` | DeviceType |

  Inherited From:
    - Hub#event:attach
  Source:
    - hub.js, line 217

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Source:
    - wedo2smarthub.js, line 319

#### color

  Emits when a color sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `color` | Color |

  Source:
    - wedo2smarthub.js, line 364

#### detach

  Emits when an attached motor or sensor is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |

  Inherited From:
    - Hub#event:detach
  Source:
    - hub.js, line 229

#### distance

  Emits when a distance sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `distance` | number | Distance, in millimeters.

  Source:
    - wedo2smarthub.js, line 353

#### rotate

  Emits when a rotation sensor is activated.

  ##### Parameters:

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

  Source:
    - wedo2smarthub.js, line 394

#### tilt

  Emits when a tilt sensor is activated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | string |
  `x` | number |
  `y` | number |

  Source:
    - wedo2smarthub.js, line 382

#### Search results