Sensors
Sensor blocks read hub/device state and provide data for conditions, events, and control logic.
Device and hub sensors
Hub battery level
Returns current hub battery level.
Device % battery
Returns the current battery level of the phone/tablet device running MOCPilot (in percent).
Board temperature
Returns hub board temperature.
- Available only for
BuWizz 2andBuWizz 3.
Button pressed
Checks whether a selected hub button matches the selected state.
-
State options:
pressed,released -
Typical button option:
center(hub-dependent) -
Note: available button options may differ by hub model (different hubs can expose different button sets).
Device type
Returns connected device type for the selected port.
- Type: reporter block
- Typical use: detect what device is connected before running device-specific logic
Device accelerometer
Returns raw accelerometer values from device sensors.
- Axis options:
x,y,z
Device acceleration
Returns acceleration data from device sensors.
- Axis options:
x,y,z
Orientation and tilt sensors
Tilt
Returns tilt angle for the selected axis.
- Axis options:
pitch,roll,yaw - Note:
yawis available only on hubs that provide yaw data.
Get orientation
Returns current orientation state of the hub.
- Output format options:
text,index - Orientation values:
Front,Top,Right,Back,Bottom,Left
Is orientation up
Checks whether the hub orientation matches selected "up" orientation.
- Orientation options:
Front,Top,Right,Back,Bottom,Left
Set tilt orientation
Configures orientation reference used by tilt/orientation-related blocks.
- Orientation options:
Front,Top,Right,Back,Bottom,Left
Timer and device motion sensors
Timer
Returns timer value in seconds.
Reset timer
Resets the timer to zero.
Port sensor blocks
Technic distance sensor
Returns distance values from a Technic distance sensor.
- Unit options:
mm,cm,inch,%
Technic when distance is
Triggers/checks distance condition for a Technic distance sensor.
- Compare options:
closer than,farther than,exactly at - Unit options:
mm,cm,inch,%
Technic sensor set mode
This block sets the Technic color sensor to the selected mode.
- Note: Changing the Color Sensor mode can affect your program in unexpected ways. For example, the Technic color sensor can't read colors or reflected light when it's in
"ambient"mode.
Technic color sensor value
Returns detected color value from a Technic distance sensor.
- Output options:
value,string
Technic when color is
Triggers/checks when detected color matches selected color.
Technic reflected light
Returns reflected light intensity.
Technic when reflected light is
Triggers/checks reflected light threshold condition.
- Compare options:
<,=,>
Technic ambient light
Returns ambient light intensity.
Technic when ambient light is
Triggers/checks ambient light threshold condition.
- Compare options:
<,=,>
Technic raw color
Returns raw color channel value from Technic sensor.
- Channel options:
red,green,blue
BOOST sensor distance
Returns distance from a BOOST distance sensor.
- Unit options:
%,cm,inch
BOOST when distance is
Triggers/checks distance condition for BOOST distance sensor.
- Compare options:
closer than,farther than,exactly at - Unit options:
%,cm,inch
BOOST sensor color
Returns color detected by a BOOST sensor.
- Output options:
value,string
BOOST is color
Checks whether BOOST sensor currently detects selected color.
BOOST reflected light
Returns reflected light value from BOOST sensor.
BOOST when reflected light is
Triggers/checks reflected light threshold condition for BOOST sensor.
- Compare options:
<,=,>
Technic Move set power mode
Sets Technic Move power mode.
- Mode options:
normal,boost
WeDo 2 distance
Returns distance from WeDo 2 distance sensor.
- Unit options:
%,cm,inch
WeDo 2 tilt
Returns tilt value from WeDo 2 tilt sensor.
- Axis options:
pitch,roll