getDMXValue syntax
  • traitdelumiere
    member
    Posts: 13
    Joined: Thu Oct 08, 2009 6:10 pm
    Contact:

    getDMXValue syntax

    by traitdelumiere » Thu May 27, 2010 6:17 pm

    Hello,

    I'd like to create some modules using DMX.

    can you help me with the syntax and use of : modul8.getDMXValues

    Is there any dictionnary for modul8 python??
    (nothing in the user manual)

    thanks

    johann
  • traitdelumiere
    member
    Posts: 13
    Joined: Thu Oct 08, 2009 6:10 pm
    Contact:

    by traitdelumiere » Mon May 31, 2010 6:48 pm

    please Help!

    Python itself is not the heart of the problem,

    The real trouble is :
    Modul8 manual is a 2.5 one.
    So there is nothing to explain how to use the 2.6 specifical functions ;
    (getsoundbands, getlevelinput, sendDMXvalue, getDMXvalue…)

    I found some answers reading the forum, but nothing clear about modul8.getDMXvalue…


    :cry:
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Mon May 31, 2010 11:23 pm

    DMX messages arrive in the DirectEvent script. The type returned is 'DMX' and the param dictionary contains these values:

    Code: Select all

     {'universe': 0, 'value': integer, 'channel': value, 'timestamp': float}


    so if you want to print the value received from channel 5 and map it to a range between 0.0 and 1.0, you can use this code:

    Code: Select all

    if type == 'DMX':
       if param['channel']==5:
          print param['value']/255.0




    to send DMX value, you can use the sendDMX function wich has these parameters:

    Code: Select all

     modul8.sendDMX(universe, channel, dmxValue)


    universe is 0 for now, and value is between 0 and 255.
  • User avatar
    david
    garageCube team
    Posts: 217
    Joined: Tue Jan 08, 2008 1:14 am
    Location: Antibes, France

    by david » Tue Jun 01, 2010 11:13 am

    To add to Eric's answer, in a Module, to get the received value, you could use :

    modul8.getDMXValues(universe)

    for now, universe is 0
    this function returns an array of 513 values.

    However, using DMX DirectEvent is the best way to go as you get the info as it is received.

    A note concerning channel numbering, in DMX, channel 0 is a special channel and you should (normally) not use it (on send/receive). So, usable channels are from 1 to 512 inclusive.

    DMX DirectEvent and modul8.sendDMX(universe, channel, dmxValue) uses the same numbering.

    Regards

    David
    David * GarageCUBE team * Modul8 developer
  • traitdelumiere
    member
    Posts: 13
    Joined: Thu Oct 08, 2009 6:10 pm
    Contact:

    by traitdelumiere » Tue Jun 01, 2010 6:58 pm

    Hi david and Sigma,

    Many thanks for your answers and for the job you did on modul8.

    Please, continue to go on that way!


    johann

Who is online

Users browsing this forum: No registered users and 17 guests