From f829d7fe112329039d651700e412945af7dcd3e4 Mon Sep 17 00:00:00 2001 From: will Date: Mon, 19 Aug 2024 23:25:57 +0100 Subject: [PATCH] Added reciver file for testing and a .gitignore --- .gitignore | 1 + clock.py | 6 +++--- reciver.py | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100755 reciver.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a699830 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./.venv diff --git a/clock.py b/clock.py index 44cf4f4..5e5cfd7 100755 --- a/clock.py +++ b/clock.py @@ -4,13 +4,13 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing import Process, Array, Value import subprocess import requests +import socket +import struct +import fcntl import time import sacn import sys import os -import socket -import struct -import fcntl # fake GPIO dummy class for debuging class dummy(): diff --git a/reciver.py b/reciver.py new file mode 100755 index 0000000..4e5f750 --- /dev/null +++ b/reciver.py @@ -0,0 +1,27 @@ +#!./.venv/bin/python + +import sacn +import sys +import os + +receiver = sacn.sACNreceiver(bind_address="192.168.8.103") +receiver.start() + +@receiver.listen_on('universe', universe=2) +def callback(packet): + if packet.dmxStartCode == 0x00: + print(packet.dmxData) + +receiver.join_multicast(2) + +try: + while True: + pass + +except KeyboardInterrupt: + receiver.leave_multicast(2) + receiver.stop() + try: + sys.exit() + except SystemExit: + os._exit(130) -- 2.39.2