Git Product home page Git Product logo

pysimpledmx's Introduction

pySimpleDMX

c0z3n 2012, GPL v3

pySimpleDMX is a simple python module designed to make basic DMX control in python easy.

pySimpleDMX is designed for and requires an Enttec USB DMX Pro or compatible hardware for communication over a DMX network.

Installation

# stable
pip install pysimpledmx
# head
pip install git+https://github.com/c0z3n/pySimpleDMX.git

Initialization

To initialize pySimpleDMX, initialize a pysimpledmx.DMXConnection() object, using the com port number of your enttec DMX USB Pro as an argument. For example, if our DMX USB Pro is on com port 3, we would initialize our dmx connection using dmx = pysimpledmx.DMXConnection(3)

If for any reason the dmx connection fails to initialize on the provided com port, pysimpledmx will let you know via the console and close.

# example
import pysimpledmx
mydmx = pysimpledmx.DMXConnection(3)
...

Usage

DMX output through pySimpleDMX is managed using a local list of size 512 in the DMXConnection() object, which represents the values for all 512 dmx channels in a single universe. When initialized, the default value for each channel is zero. to push the current list of values out over the dmx network, or 'update' the network, you must call the .render() method on your DMXConnection() object.

to change the value for a channel, use the setChannel() method on your DMXConnection() object. setChannel() requires chan (channel) and val (value) arguments, as well as an optional autorender argument, which should be set to True if you wish to have PySimpleDMX automatically update the dmx output immediately upon changing the specified channel value.

the chan and val arguments should be between 1 and 512 and between 0 and 255, respectively.

unless the autorender argument is specified True, the .render() method must be called to update the dmx output. because of the serial communication with the DMX USB Pro, this is a relatively slow operation, and thus rendering should be done sparingly to avoid bottlenecking and setting autorender is not reccomended.

# example
import pysimpledmx
mydmx = pysimpledmx.DMXConnection(3)

mydmx.setChannel(1, 255) # set DMX channel 1 to full
mydmx.setChannel(2, 128) # set DMX channel 2 to 128
mydmx.setChannel(3, 0)   # set DMX channel 3 to 0
mydmx.render() render    # render all of the above changes onto the DMX network

mydmx.setChannel(4, 255, autorender=True) # set channel 4 to full and render to the network

Development

Bumping Version
  1. Change version in ./setup.py
  2. python setup.py sdist bdist_wheel upload (requires pip install wheel)
  3. git commit -am 'bump version to x.x.x'
  4. git tag x.x.x
  5. git push --tags
  6. Add release to github tag, with changes and releasion name.

pysimpledmx's People

Contributors

c0z3n avatar nickpetty avatar saulshanabrook avatar xavierp56 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysimpledmx's Issues

From Ubuntu 13.10

Hi,

I have an USB->DMX Cable that works with Erwin Roll's DMX driver (/dev/dmx0).

I'm trying to avoid using the DMX driver to use the vanilla serial port, from /dev/ttyUSB0.

So I'm trying to use your python code and open either
/dev/ttyUSB0 or /dev/serial/by-id/usb-FTDI_USB and none work.

My DMX Light seems to never receive data.

On which platform did you develop it ? Could that work on Linux without the /dev/dmx driver ?

THanks.

Can't render

Hi,

I have some problem to connect a Contest light connected with Enttec OpenDMX USB.

So it works fine with QLC plus but I can't change colors with pySimpleDMX. It recognizes OpenDMX in /dev/ttyUSB0. Did I miss a value to change ?

In [1]: import pysimpledmx
In [2]: mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB0")
Opened /dev/ttyUSB1.
In [3]: mydmx.setChannel(2, "100", autorender=True)
In [4]: mydmx.setChannel(1, "100", autorender=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-a1d167a61129> in <module>()
----> 1 mydmx.setChannel(1, "100", autorender=True)
/usr/local/lib/python2.7/dist-packages/pysimpledmx/pysimpledmx.pyc in setChannel(self, chan, val, autorender)
     45     '''
     46     if not 1 <= chan-1 <= DMX_SIZE:
---> 47       print 'Invalid channel specified: %s' % chan-1
     48       return
     49     # clamp value
TypeError: unsupported operand type(s) for -: 'str' and 'int'

Thank you for your help.

Cant specify channel 1

It appears this part of the code throws an error while trying to set channel 1:

if not 1 <= chan-1 <= DMX_SIZE:

Channel 2 is mapping to channel 1 though when send to the fixture... confusing

Unable to install module on Pi

when i start the installation it come up with error

Traceback (most recent call last):
File "setup.py", line 2, in
from setuptools import setup, find_packages
ImportError: No module named setuptools

Convert to Python Package

Would you consider creating a package for this code by adding a setup.py and uploading it to PyPi?

It would be easier to be able to pip install pysimpledmx instead of having to download the file.

I would be happy to send a pull request with the needed files, if that is the hold up.

DMX indexing is broken

You specify that addresses are to be given on the range [1,512], yet you use them to directly index into an array of length 512. Unsurprisingly, trying to set channel 512 raises a IndexError.

I would PR but the change it so trivial it would take me more time to fork this repo than for you to just fix it.

ImportError: No module named pysimpledmx

After running pip install pysimpledmx i'm getting the error:
ImportError: No module named pysimpledmx

In my site-packages folder there is one folder called: pysimpledmx-0.1.0-py2.7.egg-info
But inside it contains no .py files

Probably a beginner python mistake.

Thanks for help :)

Dmx above 250 not working

Hey i cant seem to get an address above 250 to work , and also in some of my devices i have to set the dmx address 1 above what i need any thoughts ?

Syntax error in error message

pysimpledmx.py, line 47 should be:

print 'Invalid channel specified: %s' % (chan-1)

Note the parens around chan-1. Without them, the interpreter tries to subtract 1 from the string "Invalid..."

I've tried submitting the changes but am getting a 403 error on push (also: I'm not super familiar with pushing to GitHub repos that I don't own, which may have something to do with that).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.