spacemanspiff2007 / PyArtNet

"Python wrappers for the Art-Net protocol to send DMX over Ethernet"
GNU General Public License v3.0
67 stars 13 forks source link

Callbacks #12

Closed 42-dd closed 3 years ago

42-dd commented 3 years ago

Hi there. I really like your project. Thanks for your effort. I'm struggling to get the callbacks to work....(may be just me being quite new to python...) Is it possible to start an ArtNet node via a python script and then to callbacks on specific values? I guess that this is what your callback example is meant to do but I'm not able to open a node (tried to detect it with multiple ArtNet apps) or to get any callbacks..... `from pyartnet import ArtNetNode, DmxChannel

node = ArtNetNode('127.0.0.1') universe = node.add_universe(1)

channel = universe.add_channel(start=1, width=3)

def cb(ch: DmxChannel): ch.add_fade([0] if ch.get_channel_values() == [255] else [255], 1000)

def cb(ch: DmxChannel): if ch.get_channel_values() == 255: print('channel: full') else: print(str(ch.get_channel_values())) channel.callback_value_changed = cb ` Could you point me to where I'm doing wrong?

Cheers

spacemanspiff2007 commented 3 years ago

You have to run it as async code

42-dd commented 3 years ago

Thanks alot for your quick reply. This way I got it working. I still struggle to use the python script as ArtNet "receiver".... If I'm sending ArtNet I see the node. But I'm not able to start a node which is only receiving.

spacemanspiff2007 commented 3 years ago

But I'm not able to start a node which is only receiving.

That's currently not possible

42-dd commented 3 years ago

Thanks. Then it isn't me.... Keep up the good work