Page 1 of 1

getDMXValue syntax

Posted: Thu May 27, 2010 6:17 pm
by traitdelumiere
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

Posted: Mon May 31, 2010 6:48 pm
by traitdelumiere
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:

Posted: Mon May 31, 2010 11:23 pm
by sigmasix
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.

Posted: Tue Jun 01, 2010 11:13 am
by david
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

Posted: Tue Jun 01, 2010 6:58 pm
by traitdelumiere
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