_api.distancesensor – distance sensor functions API¶
This module contains the API functions for user interaction with a distance sensor brick.
This module is imported by the mindstorms – Mindstorms branding of the user API and spike – Spike Prime branding of the user API modules so that the API can be branded appropriately in documentation (i.e. so that Mindstorms docs can tell you to import mindstorms, and Spike Prime docs can tell you to import spike).
DistanceSensor Class¶
- class _api.distancesensor.DistanceSensor(???)¶
???
Methods
- _set_mode(???)¶
???
- _set_range_mode(???)¶
???
- _is_distance_sensor(???)¶
???
- get_distance_cm(???)¶
???
- get_distance_inches(???)¶
???
- get_distance_percentage(???)¶
???
- wait_for_distance_farther_than(???)¶
???
- wait_for_distance_closer_than(???)¶
???
- light_up(???)¶
???
- light_up_all(???)¶
???
Constants
- PERCENT = %¶
???
- CM = cm¶
???
- IN = in¶
???
- _LONG_RANGE_MODE = (0, [(0, 0)])¶
???
- _SHORT_RANGE_MODE = (1, [(1, 0)])¶
???
- _LIGHT_MODE = (5, [(5, 0), (5, 1), (5, 2), (5, 3)])¶
???
Imports¶
Function
_api.util.newSensorDisconnectedErrorFunction
utime.sleep_msFunction
util.scratch.clampFunction
util.sensors.is_typeConstant
util.constants.LPF2_FLIPPER_DISTANCE= 62Constant
util.constants.PORTS= {‘C’: Port(C), ‘B’: Port(B), ‘D’: Port(D), ‘E’: Port(E), ‘A’: Port(A), ‘F’: Port(F)}