Esempio n. 1
0
led.init()
#led.show_message("Heyy!", transition = transitions.left_scroll)

#led.show_message("Heyy!", transition = transitions.up_scroll)
#for x in range(256):
#    led.letter(x)
#    time.sleep(0.1)

while True:
    for x in range(200):
#       canvas.set_on( randrange(4),1)       
        canvas.set_on(x % 8 , 1)

#        canvas.set_on(sin((x*100) % 8 , 1)
        canvas.scroll(2)
        canvas.render()
        time.sleep(0.1)
#    canvas.clear()

#    for x in range(500):
#        canvas.set_off(randrange(8), randrange(8))
#        canvas.scroll(randrange(16))
#        canvas.render()
#        time.sleep(0.01)

#    for x in range(500):
#        canvas.set_on(4, 4)
#        canvas.scroll(randrange(8))
#        canvas.render()
#        time.sleep(0.01)
Esempio n. 2
0
    " " : [      0,       0,       0] # space
    } # create additional letters
 
def creatematrix(text):
    text = str(text)
    matrix = []
    for i in range(len(text)): # write complete pixelmatrix in a buffer
        if text[i].upper() in font5x3: # check if dictionary entry exists
            matrix = matrix + font5x3[text[i].upper()] # add letter; upper()
            matrix = matrix + [0] # add separator/space
    return matrix
 
def drawmatrix(matrix, up=0, left=0):
    for i in range(8): # fill the 8x8 matrix buffer canvas.gfxbuf
        if up < 0:
        	canvas.gfxbuf[i] = matrix[(i + left) % len(matrix)] << abs(up) # move down
        else:
    		canvas.gfxbuf[i] = matrix[(i + left) % len(matrix)] >> abs(up)
 
led.init()
horz = 0
vert = -2
speed = 15
led.brightness(0) # 0, 3, 7, 15 seems to work
 
while True:
    m = creatematrix(time.strftime("%k:%M ")) # write temporary matrix m
    horz = (horz + 1) % len(m) # scroll left
    drawmatrix(m, vert, horz) # draw 8x8 frame into gfxbuf 
    canvas.render() # draw gfxbuf into matrix
    time.sleep( 1.0 / speed ) # pause
Esempio n. 3
0
import max7219.canvas as canvas
import max7219.transitions as transitions
import time
from random import randrange

led.init()
led.show_message("Hello world!", transition=transitions.left_scroll)

for x in range(256):
    led.letter(x)
    time.sleep(0.1)

while True:
    #   for x in range(500):
    #       canvas.set_on(randrange(8), randrange(8))
    #       canvas.scroll(randrange(16))
    #       canvas.render()
    #       time.sleep(0.01)

    #   for x in range(500):
    #       canvas.set_off(randrange(8), randrange(8))
    #       canvas.scroll(randrange(16))
    #       canvas.render()
    #       time.sleep(0.01)

    for x in range(500):
        canvas.set_on(4, 4)
        canvas.scroll(randrange(8))
        canvas.render()
        time.sleep(0.01)
Esempio n. 4
0
    " " : [      0,       0,       0] # space
    } # create additional letters
 
def creatematrix(text):
    text = str(text)
    matrix = []
    for i in range(len(text)): # write complete pixelmatrix in a buffer
        if text[i].upper() in font5x3: # check if dictionary entry exists
            matrix = matrix + font5x3[text[i].upper()] # add letter; upper()
            matrix = matrix + [0] # add separator/space
    return matrix
 
def drawmatrix(matrix, up=0, left=0):
    for i in range(8): # fill the 8x8 matrix buffer canvas.gfxbuf
        if up < 0:
            canvas.gfxbuf[i] = matrix[(i + left) % len(matrix)] << abs(up) # move down
        else:
			canvas.gfxbuf[i] = matrix[(i + left) % len(matrix)] >> abs(up)
 
led.init()
horz = 0
vert = -2
speed = 15
led.brightness(0) # 0, 3, 7, 15 seems to work
 
while True:
    m = creatematrix(time.strftime("%k:%M ")) # write temporary matrix m
    horz = (horz + 1) % len(m) # scroll left
    drawmatrix(m, vert, horz) # draw 8x8 frame into gfxbuf 
    canvas.render() # draw gfxbuf into matrix
    time.sleep( 1.0 / speed ) # pause