esp-artnet-http-to-dmx/main.py

34 lines
761 B
Python

# main.py -- put your code here!
import dmx
import artnetserver
import httpserver
import fade
import time
print("starting artnet server")
# create a artnetserver object
a = artnetserver.ArtNetServer('127.0.0.1', 6454, 0)
print("starting http server")
# create a httpserver object
h = httpserver.HTTPServer("127.0.0.1", 8080)
print("creating fadehandler")
# create a fadehandler object
f = fade.FadeHandler()
# create a dmx device on UART port 1 with port 21 as direction
dmx0 = dmx.universe(1, 21)
while 1:
# get incoming artnet data
a.checkdata(dmx)
# get incoming http data
h.checkdata(dmx, f)
# checkfaders for completion and do next step
f.checkfades(dmx)
print("writing dmx")
# writing dmx data
dmx0.write_frame()