Classes

Classes

BoostMoveHub
DuploTrainBase
Hub
LPF2Hub
PoweredUP
PUPHub
PUPRemote
SPIKEPrimeHub
WeDo2SmartHub

Events


attach

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

Parameters:
Name Type Description
port string
type DeviceType
Inherited From:
Overrides:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Inherited From:
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Inherited From:
Source:

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:
Source:

detach

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

Parameters:
Name Type Description
port string
Inherited From:
Overrides:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Parameters:
Name Type Description
port string
rotation number
Inherited From:
Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
port string

If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used.

x number
y number
Inherited From:
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Inherited From:
Source:

speed

Emits on a speed change.

Parameters:
Name Type Description
port string
speed number
Inherited From:
Source:

attach

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

Parameters:
Name Type Description
port string
type DeviceType
Source:

detach

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

Parameters:
Name Type Description
port string
Source:

attach

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

Parameters:
Name Type Description
port string
type DeviceType
Inherited From:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Source:

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:

detach

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

Parameters:
Name Type Description
port string
Inherited From:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Source:

rotate

Emits when a rotation sensor is activated.

Parameters:
Name Type Description
port string
rotation number
Source:

speed

Emits on a speed change.

Parameters:
Name Type Description
port string
speed number
Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
port string

If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used.

x number
y number
Source:

discover

Emits when a Powered UP Hub device is found.

Parameters:
Name Type Description
hub WeDo2SmartHub | BoostMoveHub | PUPHub | PUPRemote | DuploTrainBase
Source:

attach

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

Parameters:
Name Type Description
port string
type DeviceType
Inherited From:
Overrides:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Inherited From:
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Inherited From:
Source:

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:
Source:

detach

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

Parameters:
Name Type Description
port string
Inherited From:
Overrides:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Inherited From:
Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
port string

If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used.

x number
y number
Inherited From:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Inherited From:
Source:

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:
Source:

attach

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

Parameters:
Name Type Description
port string
type DeviceType
Inherited From:
Overrides:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Inherited From:
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Inherited From:
Source:

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:
Source:

detach

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

Parameters:
Name Type Description
port string
Inherited From:
Overrides:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Parameters:
Name Type Description
port string
rotation number
Inherited From:
Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
port string

If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used.

x number
y number
Inherited From:
Source:

attach

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

Parameters:
Name Type Description
port string
type DeviceType
Inherited From:
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Source:

color

Emits when a color sensor is activated.

Parameters:
Name Type Description
port string
color Color
Source:

detach

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

Parameters:
Name Type Description
port string
Inherited From:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Source:

rotate

Emits when a rotation sensor is activated.

Parameters:
Name Type Description
port string
rotation number
Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
port string
x number
y number
Source: