def main_no_artsync(universe, ip='127.0.0.1', tmp=5):
    packet_size = 512
    port = 6454
    a = StupidArtnet(ip, port, universe, packet_size)
    a.flash_all()  # send single packet with all channels at 255
    file.write(StupidArtnet.print_object_and_packet(a))
    a.start()
    time.sleep(tmp)
    a.stop()
def main_no_artsync(universe1,
                    universe2,
                    ip1='127.0.0.1',
                    ip2='127.0.0.2',
                    tmp=5):
    packet_size = 512
    port = 6454
    a1 = StupidArtnet(ip1, port, universe1, packet_size)
    a2 = StupidArtnet(ip2, port, universe2, packet_size)
    a1.flash_all()  # send single packet with all channels at 255
    a2.flash_all()
    file.write(StupidArtnet.print_object_and_packet(a1))
    file.write(StupidArtnet.print_object_and_packet(a1))
    a1.start()
    a2.start()
    time.sleep(tmp)
    a1.stop()
    a2.stop()
示例#3
0

def sendImageToMatrix(img):
    for y in range(10):
        for x in range(10):
            pixel = img.getpixel((x, y))
            print(pixel, end='')
            packet[y * 30 + x * 3] = pixel[0]
            packet[y * 30 + x * 3 + 1] = pixel[1]
            packet[y * 30 + x * 3 + 2] = pixel[2]
        print()
    a.set(packet)
    a.show()


def textToImage(text):
    img = Image.new('RGB', (10, 10))
    d = ImageDraw.Draw(img)
    d.text((0, 0), text, fill=(255, 255, 255), font=fnt7)
    s = io.BytesIO()
    img.save(f'images/{text}.bmp')
    return img


img = textToImage("02")
sendImageToMatrix(img)

# hotfix lib error
a.start()
a.stop()
del a