changed from artnet to scan

Signed-off-by: Ebbe Baß <ebbe.bass>
This commit is contained in:
Ebbe Baß
2024-02-12 18:28:48 +01:00
parent 0d86194f26
commit 87521ddce2
3 changed files with 22 additions and 62 deletions
+17 -7
View File
@@ -1,6 +1,6 @@
import os
import wifi
from stupidArtnet import *
from sacn import sACNlistener
from neopixel import *
import requests
import json
@@ -72,17 +72,27 @@ def update_led_strip(dmx_values, dmx_address, strip, LED_PER_PIXEL):
# Update the LED strip
strip.show()
def listen_to_artnet(universe, dmx_address, strip, LED_PER_PIXEL):
def listen_to_sacn(universe, dmx_address, strip, LEDS_PER_PIXEL):
try:
artnet = StupidArtnet()
artnet.start(universe=universe)
# Create a new sACN listener
listener = sACNlistener()
# Configure the listener to listen to the specified universe
listener.register_listener(universe)
# Start the listener
listener.start()
while True:
dmx_values = artnet.listen()
# Get the latest data from the specified universe
packet = listener[universe].listen()
if dmx_values is not None:
update_led_strip(dmx_values, dmx_address, strip, LED_PER_PIXEL)
if packet is not None:
# Extract DMX values from the sACN packet
dmx_values = packet.dmx_frame
# Update the LED strip based on the received DMX values
update_led_strip(dmx_values, dmx_address, strip, LEDS_PER_PIXEL)
except Exception as e:
print(f"Error: {e}")