rpisensehat.py 文件源码

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

项目:PyLetMeCreate 作者: CreatorDev 项目源码 文件源码
def set_leds_state(pixels):
    """Set LED's

    Layout of the array:

    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB
    RGB RGB RGB RGB RGB RGB RGB RGB

    The first 24 bytes of the array stores the first line of the LED's, the
    following 24 bytes stores the second line, etc.
    Each value of the array should not be greater than 0x1F.

    Note: An exception is thrown if it fails.
    """
    buffer = (ctypes.c_uint8 * len(pixels))(*pixels)
    ret = _LIB.rpisensehat_set_leds_state(buffer)
    if ret < 0:
        raise Exception("rpisensehat set leds state failed")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号