color.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:PyLetMeCreate 作者: CreatorDev 项目源码 文件源码
def get_color():
    """Returns the color measurement as a tuple.

    The Color Click measures the intensity of the light by component and also
    the general intensity. The Color Click must be enabled before calling this
    function.

    Note: An exception is thrown if it fails to measure the color intensity.
    """
    clear = ctypes.c_uint16(0)
    red = ctypes.c_uint16(0)
    green = ctypes.c_uint16(0)
    blue = ctypes.c_uint16(0)
    ret = _LIB.color_click_get_color(ctypes.byref(clear),
                                     ctypes.byref(red),
                                     ctypes.byref(green),
                                     ctypes.byref(blue))
    if ret < 0:
        raise Exception("color click get color failed")

    return (clear.value, red.value, green.value, blue.value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号