Last active
November 11, 2022 16:39
-
-
Save gamblor21/25a94e286eb95047157c434ff1eab32b to your computer and use it in GitHub Desktop.
Quick demo scrolling text across a grid (20x15) of neopixels
This file contains hidden or 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 board | |
import neopixel | |
from adafruit_pixel_framebuf import PixelFramebuffer, VERTICAL | |
import time | |
from random import randint, uniform | |
import random | |
pixel_pin = board.D5 | |
pixel_width = 8 | |
pixel_height = 4 | |
pixels = neopixel.NeoPixel( | |
pixel_pin, | |
300, | |
brightness=0.3, | |
auto_write=False, | |
pixel_order=neopixel.GRBW | |
) | |
pixel_framebuf = PixelFramebuffer( | |
pixels, | |
15, | |
20, | |
orientation=VERTICAL, | |
#rotation = 1, | |
reverse_y=True, | |
) | |
#grid = PixelGrid(pixels, 15, 20, orientation=VERTICAL, alternating=True) | |
grid = pixel_framebuf._grid | |
while True: | |
pixel_framebuf.fill_rect(0, 0, 14, 20, 0x000000) | |
pixel_framebuf.display() | |
x=15 | |
while True: | |
pixel_framebuf.fill_rect(0, 0, 20, 7, 0x000000) | |
pixel_framebuf.fill_rect(0, 10, 20, 7, 0x000000) | |
pixel_framebuf.text("HAPPY HOLIDAYS", x, 0, 0x00FFFF) | |
pixel_framebuf.text(" STAY SAFE", x, 10, 0xAA00AA) | |
pixel_framebuf.display() | |
x = x - 1 | |
time.sleep(0.05) | |
if x < -100: | |
break | |
grid.fill((0,0,0)) | |
pixel_framebuf.display() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment