def blink(filename): for c in range(1, 20): f = "" if (c % 2 == 0): f = filename else: f = imagename("black.bmp") bytes = divoom_image.image_to_divoom(f) pkg = thing.create_image_package(bytes) dev.send(pkg) time.sleep(0.5)
def blink(self, filename): for c in range(1, 20): f = "" if (c % 2 == 0): f = filename else: f = "images/black.bmp" bytes = divoom_image.image_to_divoom(f) pkg = self.protocol.create_image_package(bytes) self.device.send(pkg) time.sleep(0.5)
def firework_predefined(): basename = imagename("firework") firework_files = [] for n in range(1, 9): firework_files.append(basename + str(n) + ".bmp") raw_data_packages = [] for f in firework_files: bytes = divoom_image.image_to_divoom(f) raw_data_packages.append(bytes) pkgs = thing.create_animation_packages(raw_data_packages, 0) for i in range(0, len(pkgs)): dev.send(pkgs[i])
def firework_predefined(self): basename = "images/firework" firework_files = [] for n in range(1, 9): firework_files.append(basename + str(n) + ".bmp") raw_data_packages = [] for f in firework_files: bytes = divoom_image.image_to_divoom(f) raw_data_packages.append(bytes) pkgs = self.protocol.create_animation_packages(raw_data_packages, 0) for i in range(0, len(pkgs)): self.device.send(pkgs[i])
def show_files(filelist, delay=1): for f in filelist: bytes = divoom_image.image_to_divoom(f) pkg = thing.create_image_package(bytes) dev.send(pkg) time.sleep(delay)
def show_file(self, filename): bytes = divoom_image.image_to_divoom(filename) self.show_bytes(bytes)