Classes

Classes

AbsoluteMotor
BaseHub
BasicMotor
ColorDistanceSensor
CurrentSensor
Device
DuploTrainBase
DuploTrainBaseColorSensor
DuploTrainBaseMotor
DuploTrainBaseSpeaker
DuploTraniBaseSpeedometer
Hub
HubLED
Light
LPF2Hub
Mario
MarioAccelerometer
MarioBarcodeSensor
MarioPantsSensor
MediumLinearMotor
MotionSensor
MoveHub
MoveHubMediumLinearMotor
MoveHubTiltSensor
PiezoBuzzer
RemoteControl
RemoteControlButton
SimpleMediumLinearMotor
TachoMotor
TechnicColorSensor
TechnicDistanceSensor
TechnicForceSensor
TechnicLargeAngularMotor
TechnicLargeLinearMotor
TechnicMediumAngularMotor
TechnicMediumHub
TechnicMediumHubAccelerometerSensor
TechnicMediumHubGyroSensor
TechnicMediumHubTiltSensor
TechnicXLargeLinearMotor
TiltSensor
TrainMotor
VoltageSensor
WeDo2SmartHub

Events


absolute

Emits when a the motors absolute position is changed.

Type: object
Parameters:
Name Type Description
absolute number
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

color

Emits when a color sensor is activated.

Type: object
Parameters:
Name Type Description
color Color
Source:

colorAndDistance

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

Type: object
Parameters:
Name Type Description
color Color
distance number

Distance, in millimeters.

Source:

distance

Emits when a distance sensor is activated.

Type: object
Parameters:
Name Type Description
distance number

Distance, in millimeters.

Source:

current

Emits when a current change is detected.

Type: object
Parameters:
Name Type Description
current number
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.

Type: object
Parameters:
Name Type Description
color Color
Source:

reflect

Emits when the light reflectivity changes.

Type: object
Parameters:
Name Type Description
reflect number

Percentage, from 0 to 100.

Source:

rgb

Emits when the light reflectivity changes.

Type: object
Parameters:
Name Type Description
red number
green number
blue number
Source:

speed

Emits on a speed change.

Type: object
Parameters:
Name Type Description
speed number
Source:

attach

Emits when a device is attached to the Hub.

Parameters:
Name Type Description
device Device
Source:

button

Emits when a button is pressed.

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

detach

Emits when a device is detached from the Hub.

Parameters:
Name Type Description
device Device
Source:

disconnect

Emits when the hub is disconnected.

Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Source:

button

Emits when a button is pressed.

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

accel

Emits when accelerometer detects movement. Measured in mG.

Type: object
Parameters:
Name Type Description
x number
y number
z number
Source:

gest

Emits when a gesture is detected

Type: object
Parameters:
Name Type Description
gesture number
Source:

barcode

Emits when the barcode sensor sees a barcode.

Type: object
Parameters:
Name Type Description
id number
Source:

rgb

Emits when the barcode sensor sees a RGB color.

Type: object
Parameters:
Name Type Description
r number
g number
b number
Source:

pants

Emits when the user changes the pants on Mario.

Type: object
Parameters:
Name Type Description
pants number
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

distance

Emits when a distance sensor is activated.

Type: object
Parameters:
Name Type Description
distance number

Distance, in millimeters.

Source:

button

Emits when a button is pressed.

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

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

tilt

Emits when a tilt sensor is activated.

Type: object
Parameters:
Name Type Description
x number
y number
Source:

button

Emits when a button is pressed.

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

button

Emits when a button on the remote is pressed or released.

Type: object
Parameters:
Name Type Description
event number
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Source:

ambient

Emits when the ambient light changes.

Type: object
Parameters:
Name Type Description
ambient number

Percentage, from 0 to 100.

Source:

color

Emits when a color sensor is activated.

Type: object
Parameters:
Name Type Description
color Color
Source:

reflect

Emits when the light reflectivity changes.

Type: object
Parameters:
Name Type Description
reflect number

Percentage, from 0 to 100.

Source:

distance

Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm).

Type: object
Parameters:
Name Type Description
distance number

Distance, from 40 to 2500mm

Source:

fastDistance

Emits when the detected distance changes (Fast sampling covers 50mm to 320mm).

Type: object
Parameters:
Name Type Description
fastDistance number

Distance, from 50 to 320mm

Source:

force

Emits when force is applied.

Type: object
Parameters:
Name Type Description
force number

Force, in newtons (0-10).

Source:

tapped

Emits when the sensor is tapped.

Type: object
Parameters:
Name Type Description
tapped number

How hard the sensor was tapped, from 0-3.

Source:

touch

Emits when the sensor is touched.

Type: object
Parameters:
Name Type Description
touch boolean

Touched on/off (boolean).

Source:

absolute

Emits when a the motors absolute position is changed.

Type: object
Parameters:
Name Type Description
absolute number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

absolute

Emits when a the motors absolute position is changed.

Type: object
Parameters:
Name Type Description
absolute number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

absolute

Emits when a the motors absolute position is changed.

Type: object
Parameters:
Name Type Description
absolute number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

button

Emits when a button is pressed.

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

accel

Emits when accelerometer detects movement. Measured in mG.

Type: object
Parameters:
Name Type Description
x number
y number
z number
Source:

gyro

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

Type: object
Parameters:
Name Type Description
x number
y number
z number
Source:

tilt

Emits when a tilt sensor is activated.

Type: object
Parameters:
Name Type Description
x number
y number
z number
Source:

absolute

Emits when a the motors absolute position is changed.

Type: object
Parameters:
Name Type Description
absolute number
Inherited From:
Source:

rotate

Emits when a rotation sensor is activated.

Type: object
Parameters:
Name Type Description
rotation number
Inherited From:
Source:

tilt

Emits when a tilt sensor is activated.

Type: object
Parameters:
Name Type Description
x number
y number
Source:

voltage

Emits when a voltage change is detected.

Type: object
Parameters:
Name Type Description
voltage number
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Source: