Skip to content
Snippets Groups Projects
Commit ca30f502 authored by Václav Jelínek's avatar Václav Jelínek
Browse files

Add calib function to EV3 Color sensor

parent de338cb3
No related branches found
No related tags found
No related merge requests found
Pipeline #109854 passed
......@@ -48,6 +48,7 @@ class ColorSensor(EV3UartSensor):
MODE_COLOR = const(2)
MODE_REFLECT_RAW = const(3)
MODE_RGB_RAW = const(4)
MODE_COL_CAL = const(5)
# calibration by JV
DEFAULT_RGB_CALIBRATION = ColorSensorCalibration(275, 334, 242, 0, 0, 0)
......@@ -187,3 +188,10 @@ class ColorSensor(EV3UartSensor):
return code
else: # code == 0: COLOR_NONE => return None
return None
def calibrate(self):
"""
Calibrate the sensor's RGB components and save them to sensor memory.
"""
self.read_raw_mode(ColorSensor.MODE_COL_CAL)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment