Exemple #1
0
from MyMax7219 import MyMatrix
import time

matrix = MyMatrix()

krake = [[2, 1], [3, 1], [4, 1], [5, 1], [1, 2], [3, 2], [4, 2], [6,
                                                                  2], [1, 3],
         [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [1, 4], [3, 4], [4,
                                                                  4], [5, 4],
         [6, 4], [1, 5], [6, 5], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6],
         [6, 6], [0, 7], [1, 7], [3, 7], [4, 7], [6, 7], [7, 7]]

for i in krake:
    matrix.pixel(i[0], i[1], 1)
time.sleep(5)
while True:
  keinePause = False
  newSnake = [snake[0][0]+richtung[0],
              snake[0][1]+richtung[1]]
  for i in snake:
    if(i == newSnake):
      endOfGame()
      pass

  if(newSnake == apfel):
     neuerApfel()
     keinePause = True
  else:
     snake.pop()
  snake.insert(0,newSnake)

  if(snake[0][0] > width or snake[0][1] > height
    or snake[0][0] < 0 or snake[0][1] < 0 ):
    endOfGame()
    pass

  matrix.clear()
  for i in snake:
    matrix.pixel(i[0],i[1], 1)
  matrix.pixel(apfel[0],apfel[1],1)
  if(keinePause == False):
    newLength = (len(snake)-2)*0.01
    time.sleep(0.3-newLength)
  else:
    time.sleep(0.3)
Exemple #3
0
import time

matrix = MyMatrix()

matrix.showMessage('MOIN')

for i in range(9):
    matrix.letter(str(9 - i))
    time.sleep(0.2)

matrix.clear()
time.sleep(0.2)

for i in range(8):
    for j in range(8):
        matrix.pixel(j, i, 1)
        time.sleep(0.02)
    time.sleep(0.1)

for i in range(0, 250, 20):
    matrix.brightness(i)
    time.sleep(0.2)

matrix.clear()
time.sleep(0.2)

abc = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
    'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]