from lib_pixmod import PixMod
from lib_artnet import ArtNet

import time



try:
    pixmod = PixMod()
    artnet = ArtNet(0, 0, 9)

    def clbk_packet(artnet):
        print("Uni: {} | Ch1: {} Ch2: {} Ch3: {}".format(artnet.id_universe, artnet.channels[0]//16, artnet.channels[1]//16, artnet.channels[2]//16))

        pixmod.xmit_fx(artnet.channels[0]//16, artnet.channels[1]//16, artnet.channels[2]//16, repeat=1)
        #time.sleep_ms(1000)
    artnet.clbk = clbk_packet

    while(True):
        artnet.tick()

except KeyboardInterrupt:
    pixmod.ir_led.deinit()
    artnet.s.close()
