Skip to content

Library for consuming DMX-512 over serial port (typically RS485 to RS232 converter) and detecting valid DMX frames

License

Notifications You must be signed in to change notification settings

smarek/dmx-python-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DMX-512 python serial client

Per limitation of pySerial this utility helps with properly setting the serial port on POSIX/LINUX and detecting SYNC/BREAK within the stream of data

Usage

from roh.dmx.client.dmx_client import DmxClient
from roh.dmx.client.dmx_client_callback import DmxClientCallback
from typing import Dict

# define callback, you can override even just one method, for example data_received

class MyDmxCallback(DmxClientCallback):
    """
    Example implementation of all available callback methods
    """
    def sync_lost(self) -> None:
        print("SYNC LOST")

    def sync_found(self) -> None:
        print("SYNC FOUND")

    def data_received(self, monitored_data: Dict[int, int]) -> None:
        print("VALID MONITORED DATA: %s" % monitored_data)

    def full_data_received(self, data: bytes) -> None:
        pass

# use client with /dev/ttyUSB0 port and monitor dmx address no. 1 for values
c: DmxClient = DmxClient('/dev/ttyUSB0', [1], MyDmxCallback())
c.run()

References

About

Library for consuming DMX-512 over serial port (typically RS485 to RS232 converter) and detecting valid DMX frames

Topics

Resources

License

Stars

Watchers

Forks

Languages