Classes

Classes

BoostMoveHub
ControlPlusHub
DuploTrainBase
Hub
LPF2Hub
PoweredUP
PUPHub
PUPRemote
WeDo2SmartHub

Events


accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z 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:
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:

disconnect

Emits when the hub is disconnected.

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:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

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

speed

Emits on a speed change.

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

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

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

accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z 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:
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:

disconnect

Emits when the hub is disconnected.

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:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

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

speed

Emits on a speed change.

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

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

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

accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z 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:
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:

disconnect

Emits when the hub is disconnected.

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:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

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

speed

Emits on a speed change.

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

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

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

disconnect

Emits when the hub is disconnected.

Source:

accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z number
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:

disconnect

Emits when the hub is disconnected.

Inherited From:
Source:

distance

Emits when a distance sensor is activated.

Parameters:
Name Type Description
port string
distance number

Distance, in millimeters.

Source:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
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:

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:

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:

discover

Emits when a Powered UP Hub device is found.

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

accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z 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:
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:

disconnect

Emits when the hub is disconnected.

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:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

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

speed

Emits on a speed change.

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

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

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

accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z 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:
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:

disconnect

Emits when the hub is disconnected.

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:

gyro

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

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

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

speed

Emits on a speed change.

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

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

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

disconnect

Emits when the hub is disconnected.

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: