def get_color():
"""Returns the rgb color measurement as a tuple.
Note: An exception is thrown if it fails to get a measurement from
the click.
"""
red = ctypes.c_uint16(0)
green = ctypes.c_uint16(0)
blue = ctypes.c_uint16(0)
ret = _LIB.color2_click_get_color(ctypes.byref(red),
ctypes.byref(green),
ctypes.byref(blue))
if ret < 0:
raise Exception("color2 click get color failed")
return (red.value, green.value, blue.value)
评论列表
文章目录