當前位置: 首頁>>代碼示例>>Python>>正文


Python led_matrix.FrameBuffer類代碼示例

本文整理匯總了Python中rstem.led_matrix.FrameBuffer的典型用法代碼示例。如果您正苦於以下問題:Python FrameBuffer類的具體用法?Python FrameBuffer怎麽用?Python FrameBuffer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FrameBuffer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: detect_fail

def detect_fail():
    # An unconnected chain should report IOError
    try:
        FrameBuffer.detect()
    except IOError:
        return True
    return False
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:7,代碼來源:test_led_matrix_1_90_no_miso.py

示例2: brightness

def brightness():
    '''All matrices show displays all LEDs lit, from min to max brightness over about 1 second.
    Should be left at max brightness.
    '''
    fb = FrameBuffer(matrix_layout=[(0,0,90)])
    for i in range(16):
        fb.erase(i)
        fb.show()
        time.sleep(0.1)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:9,代碼來源:test_led_matrix_1_90_no_miso.py

示例3: diagonal_wave_animation

def diagonal_wave_animation():
    '''Displays a diagonal wave animation over ~3 seconds.  Movement should
    appear in the direction from the botton right to the top left.
    '''
    fb = FrameBuffer(matrix_layout=[(0,0,90)])
    colors = list(range(16)) + list(reversed(range(16)))
    for i in range(80):
        for x in range(16):
            fb.line((x-8,0),(x,fb.height), color=colors[x])
        fb.show()
        # rotate colors
        colors = colors[1:] + colors[:1]
        time.sleep(0.04)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:13,代碼來源:test_led_matrix_1_90_no_miso.py

示例4: line5

def line5():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.line((1,3),(6,5))
    expected_fb = '''
        00000000
        00000000
        00000FF0
        000FF000
        0FF00000
        00000000
        00000000
        00000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例5: rect2

def rect2():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.rect((0,0),(8,8), fill=True)
    expected_fb = '''
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        FFFFFFFF
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例6: line3

def line3():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.line((0,0),(7,7))
    expected_fb = '''
        0000000F
        000000F0
        00000F00
        0000F000
        000F0000
        00F00000
        0F000000
        F0000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例7: init_two

def init_two():
    fb = FrameBuffer(matrix_layout=[(0,0,0), (8,0,0)])
    fb.line((0,0),(fb.width, fb.height), color=0xa)
    expected_fb = '''
        00000000000000aa
        000000000000aa00
        0000000000aa0000
        00000000aa000000
        000000aa00000000
        0000aa0000000000
        00aa000000000000
        aa00000000000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例8: point4

def point4():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.point(7,7,color=10)
    expected_fb = '''
        0000000A
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例9: point3

def point3():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.point(1,2,color=3)
    expected_fb = '''
        00000000
        00000000
        00000000
        00000000
        00000000
        03000000
        00000000
        00000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例10: point2

def point2():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.point((0,0), color=1)
    expected_fb = '''
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        10000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例11: point1

def point1():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.point(0,0)
    expected_fb = '''
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        00000000
        F0000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例12: rect3

def rect3():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.rect((2,1),(3,5), fill=True)
    expected_fb = '''
        00000000
        00000000
        00FFF000
        00FFF000
        00FFF000
        00FFF000
        00FFF000
        00000000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:14,代碼來源:test_led_matrix_1_90_no_miso.py

示例13: sprite_draw

def sprite_draw():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.erase(0xE)
    s = copy.deepcopy(default_sprite)
    fb.draw(s, origin=(2,3))
    expected_fb = '''
        EEEEEEEE
        EE123EEE
        EE456EEE
        EE789EEE
        EEABCEEE
        EEEEEEEE
        EEEEEEEE
        EEEEEEEE
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:16,代碼來源:test_led_matrix_1_90_no_miso.py

示例14: rect4

def rect4():
    fb = FrameBuffer(matrix_layout=[(0,0,0)])
    fb.rect((0,0),(4,5), color=1)
    fb.rect((2,2),(6,6), color=2)
    fb.rect((5,1),(3,3), color=3)
    fb.rect((1,5),(4,2), color=4)
    expected_fb = '''
        00222222
        04444002
        04444002
        11210002
        10210333
        10222323
        10010333
        11110000
        '''
    return arrays_equal(expected_fb, fb)
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:17,代碼來源:test_led_matrix_1_90_no_miso.py

示例15: char_on_each_matrix

def char_on_each_matrix():
    '''Verify that the numbers 0-9, A-Z are in the vertical chain of LEDs,
    lowest number at the bottom.
    '''
    chars = [Text(chr(ord('0')+i)) for i in range(10)]
    chars += [Text(chr(ord('A')+i)) for i in range(26)]

    num = FrameBuffer.detect()
    matrix_layout = [(0,y*8,90) for y in reversed(range(num))]
    fb = FrameBuffer(matrix_layout=matrix_layout)

    fb.erase()
    for i in range(num):
        fb.draw(chars[i], (2,8*i))
    fb.show()
開發者ID:readysetstem,項目名稱:readysetstem-api,代碼行數:15,代碼來源:test_led_matrix_many.py


注:本文中的rstem.led_matrix.FrameBuffer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。