Created
October 16, 2020 17:28
-
-
Save gallaugher/05fb1938aac4f99f72ca264a858c941b to your computer and use it in GitHub Desktop.
BlitzCityDIY's Party Parrot Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from random import randint | |
from micropython import const | |
import board | |
import rgbmatrix | |
import framebufferio | |
import terminalio | |
import displayio | |
import adafruit_imageload | |
import digitalio | |
import simpleio | |
import displayio | |
from adafruit_display_text import label | |
parrot0 = 0 | |
parrot1 = 1 | |
parrot2 = 2 | |
parrot3 = 3 | |
parrot4 = 4 | |
parrot5 = 5 | |
parrot6 = 6 | |
parrot7 = 7 | |
parrot8 = 8 | |
parrot9 = 9 | |
matrix = rgbmatrix.RGBMatrix( | |
width=32, bit_depth=4, | |
rgb_pins=[ | |
board.MTX_R1, | |
board.MTX_G1, | |
board.MTX_B1, | |
board.MTX_R2, | |
board.MTX_G2, | |
board.MTX_B2 | |
], | |
addr_pins=[ | |
board.MTX_ADDRA, | |
board.MTX_ADDRB, | |
board.MTX_ADDRC, | |
board.MTX_ADDRD | |
], | |
clock_pin=board.MTX_CLK, | |
latch_pin=board.MTX_LAT, | |
output_enable_pin=board.MTX_OE | |
) | |
display = framebufferio.FramebufferDisplay(matrix) | |
matrix.brightness = 0.05 | |
group = displayio.Group(max_size=20) | |
parrot, parrot_pal = adafruit_imageload.load("/partyParrotsMatrix.bmp", | |
bitmap=displayio.Bitmap, | |
palette=displayio.Palette) | |
parrot0_grid = displayio.TileGrid(parrot, pixel_shader=parrot_pal, | |
width=1, height=1, | |
tile_height=32, tile_width=32, | |
default_tile=0, | |
x=0, y=0) | |
group.append(parrot0_grid) | |
display.show(group) | |
party0 = 0 | |
p = 0 | |
while True: | |
if (party0 + 0.1) < time.monotonic(): | |
parrot0_grid[0] = p | |
p += 1 | |
party0 = time.monotonic() | |
if p > 9: | |
p = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment