def show(matrix, image, dx=0, dy=0):
    ''' show(matrix, image, dx=0, dy=0)'''
    for y, row in enumerate(image):
        bit = 1
        for x in range(8):
            matrix.pixel(dx + x, dy + y, row & bit)
            bit <<= 1
    matrix.show()
Exemple #2
0
def play(frames=f, delay=.05, tf=id):
  for f in frames:
    for y, row in enumerate(f):
      for x, mask in enumerate(xMask):
        pixel = row & mask == mask
        xPx, yPx, pixel = tf(x, y, pixel)
        if pixel:
          matrix.pixel(xPx, yPx, 1)
        else:
          matrix.pixel(xPx, yPx, 0)
  matrix.show()
  time.sleep(delay)
Exemple #3
0
def play(frames=f, delay=.05, rotate=standard):
    for frame in frames:
        for y, row in enumerate(frame):
            for x, mask in enumerate(xMask):
                pixel = row & mask == mask
                xPix, yPix, pixel = rotate(x, y, pixel)
                if pixel:
                    matrix.pixel(xPix, yPix, 1)
                else:
                    matrix.pixel(xPix, yPix, 0)
    matrix.show()
    time.sleep(delay)
Exemple #4
0
def arrowMatrix():
    matrix.fill(0)
    matrix.auto_write = False
    matrix[0,4] = 1
    matrix[1,3] = 1
    matrix[1,5] = 1
    matrix[2,2] = 1
    matrix[2,4] = 1
    matrix[2,6] = 1
    matrix[3,1] = 1
    matrix[3,4] = 1
    matrix[3,7] = 1
    matrix[4,4] = 1
    matrix[5,4] = 1
    matrix[6,4] = 1
    matrix[7,4] = 1
    matrix.show()
    matrix.auto_write = True
Exemple #5
0
import time
import adafruit_ht16k33.matrix
import board
import busio as io
import touchio

touch = touchio.TouchIn(board.D1)

i2c = io.I2C(board.SCL, board.SDA)
matrix = adafruit_ht16k33.matrix.Matrix8x8(i2c)

# pixels initializers
x_pix = y_pix = 8
x = y = 0
matrix.fill(0)
matrix.show()

# seconds to pause between frames
frame_delay = [.25, .25, .25, .25, .25, .25, .25, .25, .25, .25]

# counter for animation frames
frame_count = 0

# repeat entire animation multiple times
reps = 255
rep_count = reps

# animation bitmaps
animation = [
    # frame 1
    [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1],
def clear(matrix):
    matrix.fill(0)
    matrix.show()