def paint(self, display: Display, bg_hue: float): for pixel in self.pixels: display.set_pixel(pixel[1], pixel[2], HSVColor(pixel[0], 1.0, 1.0)) self.update_hue() self.frame += 1 if self.frame == 200: self.create_pixel() self.frame = 0
def paint(self, display: Display, bg_hue: float): for pixel in self.pixels: display.set_pixel(pixel[1], pixel[2], HSVColor(pixel[0], 1.0, 1.0)) pixel[0] += 0.002 if pixel[0] > 1.0: pixel[0] = 0.0 if abs(pixel[0] - bg_hue) < 0.01: pixel[0] = bg_hue + 0.03 pixel[1] = random.randint(0, 7) pixel[2] = random.randint(0, 7) self.frame += 1
import sys sys.path.append('..') from random import randint from ledwall.components import (SerialSender, Display, Color) #s = UDPSender(server='192.168.178.96') s = SerialSender(port_name='/dev/ttyACM0') d = Display(10, 10, s, framerate=10) while True: color = Color(randint(0, 255), randint(0, 255), randint(0, 255)) d.fill(color) for i in range(11): white = Color(randint(0, 255), randint(0, 255), randint(0, 255)) d.set_pixel(randint(0, d.columns), randint(0, d.rows), white) d.update()