_api.colorsensor – color sensor functions API¶
This module contains the API functions for user interaction with a color 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).
Constants¶
- _api.colorsensor._COLORLIST = ['black', 'violet', None, 'blue', 'cyan', 'green', None, 'yellow', None, 'red', 'white']¶
A list to allow easy mapping from color values to color names.
- _api.colorsensor._AMBIENT_MODE = (2, [(2, 0)])¶
???
- _api.colorsensor._LIGHT_MODE = (3, [(3, 0), (3, 1), (3, 2)])¶
???
- _api.colorsensor._COMBI_MODE = ([(1, 0), (0, 0), (5, 0), (5, 1), (5, 2), (5, 3)],)¶
???
ColorSensor Class¶
- class _api.colorsensor.ColorSensor(???)¶
???
Methods
- light_up_all(???)¶
???
- light_up(???)¶
???
- get_reflected_light(???)¶
???
- get_rgb_intensity(???)¶
???
- get_red(???)¶
???
- get_green(???)¶
???
- get_blue(???)¶
???
- get_ambient_light(???)¶
???
- get_color(???)¶
???
- _get_color(???)¶
???
- _set_mode(???)¶
???
- wait_until_color(???)¶
???
- wait_for_new_color(???)¶
???
Imports¶
Function
_api.util.newSensorDisconnectedErrorFunction
utime.sleep_msFunction
util.scratch.clampFunction
util.sensors.get_sensor_valueFunction
util.sensors.is_typeConstant
util.constants.LPF2_FLIPPER_COLOR= 61Constant
util.constants.PORTS= {‘C’: Port(C), ‘B’: Port(B), ‘D’: Port(D), ‘E’: Port(E), ‘A’: Port(A), ‘F’: Port(F)}